You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by sivaprasad <si...@echidnainc.com> on 2010/11/15 16:26:11 UTC

Term component sort is not working

Hi,

As part of terms component we have a parameter terms.sort=index|count.

If we put terms.sort=index, will be returns the terms in index order.

While doing the import, i have used the below query to index.

SELECT  ID,SEARCH_KEY,WEIGHTAGE FROM SEARCH_KEY_WEIGHTAGE ORDER BY weightage
DESC

So the top WEIGHTAGE document will be first indexed.While returning it is
not happening like that.How can i get the top weightage term first, in the
result of the matched term?


Regards,
Siva

-- 
View this message in context: http://lucene.472066.n3.nabble.com/Term-component-sort-is-not-working-tp1905059p1905059.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Term component sort is not working

Posted by Ahmet Arslan <io...@yahoo.com>.
> I am capturing all the user entered search terms in to the
> database and the number of times the search term is
> entered.Let us say
> 
> "laptop" has entered 100 times.
> "laptop bag" has entered 80 times.
> "laptop battery" has entered 90 times.
> 
> I am using terms component for auto suggest feature.If the
> user types for "lap" , i am getting response as 
> "laptop bag"
> "laptop"
> "laptop battery"
> 
> But i should get "laptop"
>              
>    "laptop battery"
>              
>    "laptop bag"
> 
> As "laptop" is entered by more number of times it should
> come first in the result.In this case i need to utilize the
> WEIGHTAGE(the number times searched) for sorting.

Then you can use this approached (instead of Terms Component) described here: http://www.lucidimagination.com/blog/2009/09/08/auto-suggest-from-popular-queries-using-edgengrams/


      

Re: Term component sort is not working

Posted by sivaprasad <si...@echidnainc.com>.
I am capturing all the user entered search terms in to the database and the number of times the search term is entered.Let us say

"laptop" has entered 100 times.
"laptop bag" has entered 80 times.
"laptop battery" has entered 90 times.

I am using terms component for auto suggest feature.If the user types for "lap" , i am getting response as 
"laptop bag"
"laptop"
"laptop battery"

But i should get "laptop"
                 "laptop battery"
                 "laptop bag"

As "laptop" is entered by more number of times it should come first in the result.In this case i need to utilize the WEIGHTAGE(the number times searched) for sorting.
                 

Regards,
Siva

-----Original Message-----
From: "Erick Erickson [via Lucene]" <ml...@n3.nabble.com>
Sent: Tuesday, November 16, 2010 7:52am
To: "sivaprasad" <si...@echidnainc.com>
Subject: Re: Term component sort is not working




You haven't defined what you want to see, so it's hard
to help. What does "top" mean? The order you put it
into the index? Lexical sort? Frequency count?
Numerical ordering?

Why do you want to do this? Perhaps if you explained
your use case we'd be able to offer some alternatives.

Best
Erick

On Tue, Nov 16, 2010 at 1:22 AM, sivaprasad <si...@echidnainc.com>wrote:

>
>
> Hi,
>
> I have given the terms component configuration.
>
> <searchComponent name="termsComponent"
> class="org.apache.solr.handler.component.TermsComponent"/>
>
>  <requestHandler name="/autoSuggest"
> class="org.apache.solr.handler.component.SearchHandler">
>     <lst name="defaults">
>      <bool name="terms">true</bool>
>          <str name="terms.fl">autoSuggestTerm</str>
>          <str name="terms.sort">index</str>
>    </lst>
>    <arr name="components">
>      <str>termsComponent</str>
>    </arr>
>  </requestHandler>
>
> And i have two fileds in schema file
>
> <field name="autoSuggestTerm" type="string" indexed="true" stored="true"/>
>  <field name="WEIGHTAGE" type="integer" stored="true"/>
>
> Now iam trying to sort the terms which are returned by terms component
> based
> on WEIGHTAGE  field.
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Term-component-sort-is-not-working-tp1905059p1909386.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>


______________________________________
View message @ http://lucene.472066.n3.nabble.com/Term-component-sort-is-not-working-tp1905059p1910694.html
To start a new topic under Solr - User, email ml-node+472068-1030716887-225436@n3.nabble.com
To unsubscribe from Solr - User, click http://lucene.472066.n3.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=472068&code=c2l2YXByYXNhZC5qQGVjaGlkbmFpbmMuY29tfDQ3MjA2OHwtMjAyODMzMTY4OQ==



-- 
View this message in context: http://lucene.472066.n3.nabble.com/Term-component-sort-is-not-working-tp1905059p1910874.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Term component sort is not working

Posted by Erick Erickson <er...@gmail.com>.
You haven't defined what you want to see, so it's hard
to help. What does "top" mean? The order you put it
into the index? Lexical sort? Frequency count?
Numerical ordering?

Why do you want to do this? Perhaps if you explained
your use case we'd be able to offer some alternatives.

Best
Erick

On Tue, Nov 16, 2010 at 1:22 AM, sivaprasad <si...@echidnainc.com>wrote:

>
>
> Hi,
>
> I have given the terms component configuration.
>
> <searchComponent name="termsComponent"
> class="org.apache.solr.handler.component.TermsComponent"/>
>
>  <requestHandler name="/autoSuggest"
> class="org.apache.solr.handler.component.SearchHandler">
>     <lst name="defaults">
>      <bool name="terms">true</bool>
>          <str name="terms.fl">autoSuggestTerm</str>
>          <str name="terms.sort">index</str>
>    </lst>
>    <arr name="components">
>      <str>termsComponent</str>
>    </arr>
>  </requestHandler>
>
> And i have two fileds in schema file
>
> <field name="autoSuggestTerm" type="string" indexed="true" stored="true"/>
>  <field name="WEIGHTAGE" type="integer" stored="true"/>
>
> Now iam trying to sort the terms which are returned by terms component
> based
> on WEIGHTAGE  field.
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Term-component-sort-is-not-working-tp1905059p1909386.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Term component sort is not working

Posted by sivaprasad <si...@echidnainc.com>.
 
Hi,

I have given the terms component configuration.

<searchComponent name="termsComponent"
class="org.apache.solr.handler.component.TermsComponent"/>

  <requestHandler name="/autoSuggest"
class="org.apache.solr.handler.component.SearchHandler">
     <lst name="defaults">
      <bool name="terms">true</bool>
	  <str name="terms.fl">autoSuggestTerm</str>	 
	  <str name="terms.sort">index</str>
    </lst>     
    <arr name="components">
      <str>termsComponent</str>
    </arr>
  </requestHandler>

And i have two fileds in schema file

<field name="autoSuggestTerm" type="string" indexed="true" stored="true"/>
 <field name="WEIGHTAGE" type="integer" stored="true"/>

Now iam trying to sort the terms which are returned by terms component based
on WEIGHTAGE  field.
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Term-component-sort-is-not-working-tp1905059p1909386.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Term component sort is not working

Posted by Erick Erickson <er...@gmail.com>.
Would it answer to sort on your Weightage field? Note that
your weightage field has to be comparable. that is, if you store
it as a string, it must be normalized such that the dictionary
comparison works. 5 would sort after 1000 unless you padded
your 5 to something like 0005...

Best
Erick

On Mon, Nov 15, 2010 at 12:31 PM, sivaprasad <si...@echidnainc.com>wrote:

>
> How can i utilize the weightage of terms which i captured from end user?
> any
> ideas....
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Term-component-sort-is-not-working-tp1905059p1905958.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Term component sort is not working

Posted by sivaprasad <si...@echidnainc.com>.
How can i utilize the weightage of terms which i captured from end user? any
ideas....
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Term-component-sort-is-not-working-tp1905059p1905958.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Term component sort is not working

Posted by Ahmet Arslan <io...@yahoo.com>.
> As part of terms component we have a parameter
> terms.sort=index|count.
> 
> If we put terms.sort=index, will be returns the terms in
> index order.

terms.sort=index means sort by lexicographic. Like normal dictionary.