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 Utkarsh Sengar <ut...@gmail.com> on 2013/08/02 23:27:18 UTC

Suggest aka "autocomplete" request handler with solr 4.4

I am trying to get autocorrect and suggest feature work on my solr 4.4
setup.

As recommended here: http://wiki.apache.org/solr/Suggester, this is my
solrconfig: http://apaste.info/eBPr

Where "allText" is a copy field which indexes all the content I have in
document title, description etc.

I am trying to use it like this:
http://solr_server/solr/core1/suggest?q=appl and I expect to see "apple"
but I get this response:

<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">0</int>
</lst>
</response>

I have reindexed my data after adding this config (i.e. loading the whole
dataset again via UpdateCSV), also tried to reload the core via http.

So, I have 2 questions:

1. Is there a better way to reindex from the solr admin panel directly
without actually going through the process of loading the data again?

2. Any suggestions on what am I missing with the "suggest" request handler?

-- 
Thanks,
-Utkarsh

Re: Suggest aka "autocomplete" request handler with solr 4.4

Posted by Jack Krupansky <ja...@basetechnology.com>.
What does your allText field's type look like? Does it lower-case terms like 
Apple->apple?

Are you sure that "apple" is indexed in that field?

For comparison, or an alternative, try using the Solr terms component to see 
what terms are actually indexed in that field:

curl 
"http://localhost:8983/solr/terms?terms.fl=allText&terms.limit=100&indent=true"

-- Jack Krupansky

-----Original Message----- 
From: Utkarsh Sengar
Sent: Monday, August 05, 2013 7:40 PM
To: solr-user@lucene.apache.org
Subject: Re: Suggest aka "autocomplete" request handler with solr 4.4

Bumping this one, is this feature maintained anymore?

Thanks,
-Utkarsh


On Fri, Aug 2, 2013 at 2:27 PM, Utkarsh Sengar <ut...@gmail.com>wrote:

> I am trying to get autocorrect and suggest feature work on my solr 4.4
> setup.
>
> As recommended here: http://wiki.apache.org/solr/Suggester, this is my
> solrconfig: http://apaste.info/eBPr
>
> Where "allText" is a copy field which indexes all the content I have in
> document title, description etc.
>
> I am trying to use it like this:
> http://solr_server/solr/core1/suggest?q=appl and I expect to see "apple"
> but I get this response:
>
> <response>
> <lst name="responseHeader">
> <int name="status">0</int>
> <int name="QTime">0</int>
> </lst>
> </response>
>
> I have reindexed my data after adding this config (i.e. loading the whole
> dataset again via UpdateCSV), also tried to reload the core via http.
>
> So, I have 2 questions:
>
> 1. Is there a better way to reindex from the solr admin panel directly
> without actually going through the process of loading the data again?
>
> 2. Any suggestions on what am I missing with the "suggest" request 
> handler?
>
> --
> Thanks,
> -Utkarsh
>



-- 
Thanks,
-Utkarsh 


Re: Suggest aka "autocomplete" request handler with solr 4.4

Posted by Utkarsh Sengar <ut...@gmail.com>.
Bumping this one, is this feature maintained anymore?

Thanks,
-Utkarsh


On Fri, Aug 2, 2013 at 2:27 PM, Utkarsh Sengar <ut...@gmail.com>wrote:

> I am trying to get autocorrect and suggest feature work on my solr 4.4
> setup.
>
> As recommended here: http://wiki.apache.org/solr/Suggester, this is my
> solrconfig: http://apaste.info/eBPr
>
> Where "allText" is a copy field which indexes all the content I have in
> document title, description etc.
>
> I am trying to use it like this:
> http://solr_server/solr/core1/suggest?q=appl and I expect to see "apple"
> but I get this response:
>
> <response>
> <lst name="responseHeader">
> <int name="status">0</int>
> <int name="QTime">0</int>
> </lst>
> </response>
>
> I have reindexed my data after adding this config (i.e. loading the whole
> dataset again via UpdateCSV), also tried to reload the core via http.
>
> So, I have 2 questions:
>
> 1. Is there a better way to reindex from the solr admin panel directly
> without actually going through the process of loading the data again?
>
> 2. Any suggestions on what am I missing with the "suggest" request handler?
>
> --
> Thanks,
> -Utkarsh
>



-- 
Thanks,
-Utkarsh

Re: Suggest aka "autocomplete" request handler with solr 4.4

Posted by Utkarsh Sengar <ut...@gmail.com>.
HI Chris,
You were right, "appl" was  matched to "application". So, I created a new
type without the stemmer.

New type:
<fieldType name="text_spell" class="solr.TextField"
positionIncrementGap="100">
             <analyzer type="index">
                  <tokenizer class="solr.StandardTokenizerFactory"/>
                  <filter class="solr.StopFilterFactory" ignoreCase="true"
words="stopwords.txt" enablePositionIncrements="true" />
                  <filter class="solr.LowerCaseFilterFactory"/>
                  <filter class="solr.ASCIIFoldingFilterFactory"/>
                  <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
            </analyzer>
            <analyzer type="query">
                  <filter class="solr.WordDelimiterFilterFactory"
generateWordParts="1" generateNumberParts="1"

catenateWords="1"

catenateNumbers="1"

catenateAll="0"

preserveOriginal="1"/>
                  <tokenizer class="solr.StandardTokenizerFactory"/>
                  <filter class="solr.StopFilterFactory" ignoreCase="true"
words="stopwords.txt" enablePositionIncrements="true" />
                  <filter class="solr.LowerCaseFilterFactory"/>
                  <filter class="solr.ASCIIFoldingFilterFactory"/>
                  <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
            </analyzer>

Which has a field:
<field name="spellText" type="text_spell" indexed="true" stored="false"
multiValued="true" omitNorms="true" termVectors="false"
termPositions="false" termOffsets="false"/>

Which is a copyField:
    <copyField source="title" dest="spellText"/>
    <copyField source="description" dest="spellText"/>
    <copyField source="category" dest="spellText"/>
    <copyField source="brand" dest="spellText"/>
    <copyField source="subtitle" dest="spellText"/>


Although this is my problem now:
When I run this query:
http://SOLR_SERVER/solr/prodinfo/spell?q=delll&spellcheck=true&spellcheck.collate=true&spellcheck.build=true

I get this response:
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">9</int>
</lst>
<str name="command">build</str>
<result name="response" numFound="0" start="0" maxScore="0.0"/>
<lst name="spellcheck">
<lst name="suggestions">
<bool name="correctlySpelled">false</bool>
</lst>
</lst>
</response>

It knows the term is incorrect, but I don't get any suggestions back. What
can be wrong here?

Thanks,
-Utkarsh


On Thu, Aug 8, 2013 at 7:19 AM, Vinícius <vi...@gmail.com> wrote:

> if correctSpelled is true, then "appl" was found in solr index. In this
> case, maybe  the EnglishMinimalStemFilterFactory filter in text_general
> fieldType is messing your suggestion.
>
>
> On 6 August 2013 15:33, Utkarsh Sengar <ut...@gmail.com> wrote:
>
> > Jack/Chris,
> >
> > 1. This is my complete schema.xml:
> >
> >
> https://gist.github.com/utkarsh2012/6167128/raw/1d5ac6520b666435cd040b5cc6dcb434cdfd7925/schema.xml
> > More specifically, allText is of type: text_general which has a
> > LowerCaseFatcory during index time.
> >
> > 2. allText has values:
> >
> >
> http://solr_server/solr/prodinfo/terms?terms.fl=allText&terms.limit=100&indent=truereturns
> > a lot of values. I have never used the /term request handler, but
> > it very slow.
> >
> > 3. When I try this query:
> >
> >
> http://solr_server/solr/prodinfo/spell?q=appl&spellcheck=true&spellcheck.collate=true&spellcheck.build=true
> > ,
> > I get documents back which match the query: "appl". But my expectation is
> > to get the spell corrected keywords back like "apple" AND the documents
> > with the keyword "apple".
> > Response from the above query:
> > <result>
> > <doc>.....</doc>
> > <doc>.....</doc>
> > ......
> > </result>
> > <lst name="spellcheck">
> > <lst name="suggestions">
> > <bool name="correctlySpelled">true</bool>
> > </lst>
> > </lst>
> >
> > Thanks,
> > -Utkarsh
> >
> >
> >
> > On Mon, Aug 5, 2013 at 4:56 PM, Chris Hostetter <
> hossman_lucene@fucit.org
> > >wrote:
> >
> > >
> > > : Where "allText" is a copy field which indexes all the content I have
> in
> > > : document title, description etc.
> > >
> > > what does the field & fieldType of "allText" look like?
> > >
> > > : I have reindexed my data after adding this config (i.e. loading the
> > whole
> > > : dataset again via UpdateCSV), also tried to reload the core via http.
> > >
> > > did you note the comments on that page regarding "spellcheck.build" ?
> > >
> > > " NOTE: currently implemented Lookup-s keep their data in memory, so
> > > unlike spellchecker data this data is discarded on core reload and not
> > > available until you invoke the build command, either explicitly or
> > > implicitly via commit. "
> > >
> > >
> > >
> > > -Hoss
> > >
> >
> >
> >
> > --
> > Thanks,
> > -Utkarsh
> >
>



-- 
Thanks,
-Utkarsh

Re: Suggest aka "autocomplete" request handler with solr 4.4

Posted by Vinícius <vi...@gmail.com>.
if correctSpelled is true, then "appl" was found in solr index. In this
case, maybe  the EnglishMinimalStemFilterFactory filter in text_general
fieldType is messing your suggestion.


On 6 August 2013 15:33, Utkarsh Sengar <ut...@gmail.com> wrote:

> Jack/Chris,
>
> 1. This is my complete schema.xml:
>
> https://gist.github.com/utkarsh2012/6167128/raw/1d5ac6520b666435cd040b5cc6dcb434cdfd7925/schema.xml
> More specifically, allText is of type: text_general which has a
> LowerCaseFatcory during index time.
>
> 2. allText has values:
>
> http://solr_server/solr/prodinfo/terms?terms.fl=allText&terms.limit=100&indent=truereturns
> a lot of values. I have never used the /term request handler, but
> it very slow.
>
> 3. When I try this query:
>
> http://solr_server/solr/prodinfo/spell?q=appl&spellcheck=true&spellcheck.collate=true&spellcheck.build=true
> ,
> I get documents back which match the query: "appl". But my expectation is
> to get the spell corrected keywords back like "apple" AND the documents
> with the keyword "apple".
> Response from the above query:
> <result>
> <doc>.....</doc>
> <doc>.....</doc>
> ......
> </result>
> <lst name="spellcheck">
> <lst name="suggestions">
> <bool name="correctlySpelled">true</bool>
> </lst>
> </lst>
>
> Thanks,
> -Utkarsh
>
>
>
> On Mon, Aug 5, 2013 at 4:56 PM, Chris Hostetter <hossman_lucene@fucit.org
> >wrote:
>
> >
> > : Where "allText" is a copy field which indexes all the content I have in
> > : document title, description etc.
> >
> > what does the field & fieldType of "allText" look like?
> >
> > : I have reindexed my data after adding this config (i.e. loading the
> whole
> > : dataset again via UpdateCSV), also tried to reload the core via http.
> >
> > did you note the comments on that page regarding "spellcheck.build" ?
> >
> > " NOTE: currently implemented Lookup-s keep their data in memory, so
> > unlike spellchecker data this data is discarded on core reload and not
> > available until you invoke the build command, either explicitly or
> > implicitly via commit. "
> >
> >
> >
> > -Hoss
> >
>
>
>
> --
> Thanks,
> -Utkarsh
>

Re: Suggest aka "autocomplete" request handler with solr 4.4

Posted by Utkarsh Sengar <ut...@gmail.com>.
Jack/Chris,

1. This is my complete schema.xml:
https://gist.github.com/utkarsh2012/6167128/raw/1d5ac6520b666435cd040b5cc6dcb434cdfd7925/schema.xml
More specifically, allText is of type: text_general which has a
LowerCaseFatcory during index time.

2. allText has values:
http://solr_server/solr/prodinfo/terms?terms.fl=allText&terms.limit=100&indent=truereturns
a lot of values. I have never used the /term request handler, but
it very slow.

3. When I try this query:
http://solr_server/solr/prodinfo/spell?q=appl&spellcheck=true&spellcheck.collate=true&spellcheck.build=true,
I get documents back which match the query: "appl". But my expectation is
to get the spell corrected keywords back like "apple" AND the documents
with the keyword "apple".
Response from the above query:
<result>
<doc>.....</doc>
<doc>.....</doc>
......
</result>
<lst name="spellcheck">
<lst name="suggestions">
<bool name="correctlySpelled">true</bool>
</lst>
</lst>

Thanks,
-Utkarsh



On Mon, Aug 5, 2013 at 4:56 PM, Chris Hostetter <ho...@fucit.org>wrote:

>
> : Where "allText" is a copy field which indexes all the content I have in
> : document title, description etc.
>
> what does the field & fieldType of "allText" look like?
>
> : I have reindexed my data after adding this config (i.e. loading the whole
> : dataset again via UpdateCSV), also tried to reload the core via http.
>
> did you note the comments on that page regarding "spellcheck.build" ?
>
> " NOTE: currently implemented Lookup-s keep their data in memory, so
> unlike spellchecker data this data is discarded on core reload and not
> available until you invoke the build command, either explicitly or
> implicitly via commit. "
>
>
>
> -Hoss
>



-- 
Thanks,
-Utkarsh

Re: Suggest aka "autocomplete" request handler with solr 4.4

Posted by Chris Hostetter <ho...@fucit.org>.
: Where "allText" is a copy field which indexes all the content I have in
: document title, description etc.

what does the field & fieldType of "allText" look like?

: I have reindexed my data after adding this config (i.e. loading the whole
: dataset again via UpdateCSV), also tried to reload the core via http.

did you note the comments on that page regarding "spellcheck.build" ?

" NOTE: currently implemented Lookup-s keep their data in memory, so 
unlike spellchecker data this data is discarded on core reload and not 
available until you invoke the build command, either explicitly or 
implicitly via commit. "



-Hoss