Facets and sort

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Facets and sort

Guillaume Smet
Hi all,

I'm currently playing with solr (a nightly build of sep. 16) to see if
it can fit our needs. It's really a great piece of software and I
especially appreciate the facetting features.

I now have something that works really well and there's only one problem left:
- I want to sort the results by title: I do it via a sort=title_t asc parameter
- when I don't apply any facetting filter, it works well, my results
are sorted by title. Search URL is:
http://localhost:8080/solr/select?fl=%2A%2C+score&sort=titre_t+asc&facet=true&facet.mincount=1&facet.query=prix_min_i%3A%5B%2A+TO+7%5D&facet.query=prix_min_i%3A%5B8+TO+15%5D&facet.query=prix_min_i%3A%5B16+TO+30%5D&facet.query=prix_min_i%3A%5B31+TO+60%5D&facet.query=prix_min_i%3A%5B61+TO+90%5D&facet.query=prix_min_i%3A%5B91+TO+%2A%5D&f.note_i.facet.sort=false&facet.field=quartier_facet&facet.field=genres_mfacet&facet.field=note_i&version=2.2&wt=json&q=%2B%28type_objet%3Alieu%29+%2B%28ville_facet%3ALYO%29+%2B%28theme_facet%3ARES%29+&start=0&rows=20
- the problem is that as soon as I apply a facetting filter via
qf=facet:value, I can't get my results sorted. Search URL:
http://localhost:8080/solr/select?fl=%2A%2C+score&sort=titre_t+asc&facet=true&facet.mincount=1&facet.query=prix_min_i%3A%5B%2A+TO+7%5D&facet.query=prix_min_i%3A%5B8+TO+15%5D&facet.query=prix_min_i%3A%5B16+TO+30%5D&facet.query=prix_min_i%3A%5B31+TO+60%5D&facet.query=prix_min_i%3A%5B61+TO+90%5D&facet.query=prix_min_i%3A%5B91+TO+%2A%5D&f.note_i.facet.sort=false&facet.field=quartier_facet&facet.field=genres_mfacet&facet.field=note_i&fq=quartier_facet%3ALY02E&version=2.2&wt=json&q=%2B%28type_objet%3Alieu%29+%2B%28ville_facet%3ALYO%29+%2B%28theme_facet%3ARES%29+&start=0&rows=20

Is there anything special to do to have sorted results when using
facetting? If the problem is not obvious, I can provide more
information if needed.

Thanks in advance.

--
Guillaume
Reply | Threaded
Open this post in threaded view
|

Re: Facets and sort

hossman

: - I want to sort the results by title: I do it via a sort=title_t asc parameter
: - when I don't apply any facetting filter, it works well, my results
: are sorted by title. Search URL is:
        ...
: - the problem is that as soon as I apply a facetting filter via
: qf=facet:value, I can't get my results sorted. Search URL:

a couple of things...
1) "qf" is not a faceting or filtering option ... it's a dismax specific
option and you don't seem to be using dismax. ... i think you ment "fq"
(which is what actually seems to be different in the two URLs)

2) you said you want to sort on "title_t asc" ... but in both URLs you are
sorting on "titre_t asc" ... i'm not certain which one is the typo, but
i'm guessing it's the URLs and if you look closely at all the pages of
results i'm guessing the first query isn't really sorting correctly
either.




-Hoss

Reply | Threaded
Open this post in threaded view
|

Re: Facets and sort

Guillaume Smet
Hi Chris,

On 9/24/07, Chris Hostetter <[hidden email]> wrote:
> 1) <snip>
> 2) <snip>

In fact both were typos in my email: the code is right. It was a bit
late here. After a few hours of sleep, I think the problem is that I
sort on a tokenized value. Without a facet filter, I have enough
results to have only results containing one word beginning by A on the
first page but as soon as I apply a filter I don't have enough results
to do so and then I begin to see results sorted on other tokens.
I'll try to create a new strField used only for sorting to see if it
solves my problem and let you know. I didn't think that was it as it
seemed to work without facet filtering but I'm more and more convinced
it's the problem.

Thanks for your answer.

--
Guillaume
Reply | Threaded
Open this post in threaded view
|

Re: Facets and sort

hossman
: late here. After a few hours of sleep, I think the problem is that I
: sort on a tokenized value. Without a facet filter, I have enough

sorting on a tokenized field is definitely a no-no ... the only situation
in which that will work is if your tokenizer produces only one token per
document (ie: KeywrodTokenizer)



-Hoss

Reply | Threaded
Open this post in threaded view
|

Re: Facets and sort

Guillaume Smet
On 9/24/07, Chris Hostetter <[hidden email]> wrote:
> sorting on a tokenized field is definitely a no-no ... the only situation
> in which that will work is if your tokenizer produces only one token per
> document (ie: KeywrodTokenizer)

Yes, it works now. I have now based my sort field on the alphaOnlySort
type present in the example schema.xml.

Thanks for your help.

--
Guillaume