I wasn't clear enough. What I meant was that basically your integer field
should not be multivalued. That's it.

If on the other hand your integer field is multivalued, sort will not work.
You will have to figure out some sort of a conditional boosting approach
wherein you check the integer value and then apply a boost based on some
mathematical formula to either send the doc to the top or send it to the
end of the list

On Mon, 21 Dec 2015, 17:40 Abhishek Mishra <solrmis...@gmail.com> wrote:

> Hi binoy it will not work as category and integer is one to one mapping so
> if category_id is multivalued same goes to integer also. and you need some
> kind of mechanism which will identify which integer to pick given to
> category_id for search thenafter you can implement sort according to it.
>
> On Mon, Dec 21, 2015 at 5:27 PM, Binoy Dalal <binoydala...@gmail.com>
> wrote:
>
> > Small edit:
> > The sort parameter in the solrconfig goes in the request handler
> > declaration that you're using. So if it's select, put in the <LST
> > name="defaults"> list.
> >
> > On Mon, 21 Dec 2015, 17:21 Binoy Dalal <binoydala...@gmail.com> wrote:
> >
> > > OK. You will only be able to sort based on the integers if the integer
> > > field is single valued, I.e. only one integer is associated with one
> > > category I'd.
> > >
> > > To do this you've to use the sort parameter.
> > > You can either specify it in your solrconfig.XML like so:
> > > <str name="sort">integer asc</str>
> > > Field name followed by the order - asc/desc
> > >
> > > Or you can specify the it along with our query by appending it to your
> > > query like so:
> > > /select?q=query&sort=integet%20asc
> > >
> > > If you want to apply these sorting rules for all docs, then specify the
> > > sorting in your solrconfig. If you only want It for a certain subset
> then
> > > apply the parameter from code at the app level
> > >
> > > On Mon, 21 Dec 2015, 16:49 Abhishek Mishra <solrmis...@gmail.com>
> wrote:
> > >
> > >> hi binoy
> > >> thanks for reply. I mean by sort is to sort the data-sets on the basis
> > of
> > >> integers values given for that category.
> > >> For any document let say for an id P1,
> > >> category associated is c1,c2,c3,c4 (using multivalued field)
> > >> For new implementation
> > >> similarly a number is associated with each category. let say
> > >> c1---b1,c2---b2,c3---b3,c4---b4.
> > >> now when we querying into solr for the ids which have c1 in their
> > >> categories. (q=category_id:c1) now i want the result of this query
> > sorted
> > >> on the basis of number(b) associated with it throughout the result..
> > >>
> > >> number of association is usually less than 20 (means an id can't be
> > mapped
> > >> more than 20 category_ids)
> > >>
> > >>
> > >> On Mon, Dec 21, 2015 at 3:59 PM, Binoy Dalal <binoydala...@gmail.com>
> > >> wrote:
> > >>
> > >> > When you say sort, do you mean search on the basis of category and
> > >> > integers? Or score the docs based on their category and integer
> > values?
> > >> >
> > >> > Also, for any given document, how many categories or integers are
> > >> > associated with it?
> > >> >
> > >> > On Mon, 21 Dec 2015, 14:43 Abhishek Mishra <solrmis...@gmail.com>
> > >> wrote:
> > >> >
> > >> > > Hello all
> > >> > >
> > >> > > i am facing some kind of requirement that where for an id p1 is
> > >> > associated
> > >> > > with some category_ids c1,c2,c3,c4 with some integers b1,b2,b3,b4.
> > We
> > >> > need
> > >> > > to sort the query of solr on the basis of b1/b2/b3/b4 depending on
> > >> given
> > >> > > category_id . Right now we mapped the category_ids into
> multi-valued
> > >> > > attribute. [c1,c2,c3,c4] something like this. we are querying into
> > it.
> > >> > But
> > >> > > from now we also need to find which integer b1,b2,b3.. associated
> > with
> > >> > > given category and also sort the whole query on it.
> > >> > >
> > >> > >
> > >> > > sorry for any typos..
> > >> > >
> > >> > > Regards
> > >> > > Abhishek
> > >> > >
> > >> > --
> > >> > Regards,
> > >> > Binoy Dalal
> > >> >
> > >>
> > > --
> > > Regards,
> > > Binoy Dalal
> > >
> > --
> > Regards,
> > Binoy Dalal
> >
>
-- 
Regards,
Binoy Dalal

Reply via email to