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 vicky desai <vi...@germinait.com> on 2013/04/19 16:59:03 UTC

is phrase search possible in solr

I want to do a phrase search in solr without analyzers being applied to it 
eg - If I search for *"DelhiDareDevil"* (i.e - with inverted commas)it
should search the exact text and not apply any analyzers or tokenizers on
this field
However if i search for *DelhiDareDevil* it should use tokenizers and
analyzers and split it to something like this *delhi dare devil*

My schema definition for this is as follows

    <fieldType name="text" class="solr.TextField"
    			positionIncrementGap="100" autoGeneratePhraseQueries="false">
    			<analyzer type="index">
    				<tokenizer class="solr.WhitespaceTokenizerFactory" />
    				<filter class="solr.WordDelimiterFilterFactory"
    					generateWordParts="1" generateNumberParts="1" catenateWords="1"
    					catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"
preserveOriginal="1"/>
    				<filter class="solr.LowerCaseFilterFactory" />
    			</analyzer>
    			<analyzer type="query">
    				<tokenizer class="solr.WhitespaceTokenizerFactory" />
    				<filter class="solr.WordDelimiterFilterFactory"
    					generateWordParts="1" generateNumberParts="1" catenateWords="1"
    					catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"
preserveOriginal="1"/>
    				<filter class="solr.LowerCaseFilter``Factory" />
    			</analyzer>
    		</fieldType>
    
    <field name="cContent" type="text" indexed="true" stored="true"
multiValued="false"/>

any help would be appreciated




--
View this message in context: http://lucene.472066.n3.nabble.com/is-phrase-search-possible-in-solr-tp4057312.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Dynamically loading Elevation Info

Posted by Chris Hostetter <ho...@fucit.org>.
: In-Reply-To: <13...@n3.nabble.com>
: References: <13...@n3.nabble.com>
:  <B3...@gmail.com>
:  <13...@n3.nabble.com>
: Subject: Dynamically loading Elevation Info

https://people.apache.org/~hossman/#threadhijack
Thread Hijacking on Mailing Lists

When starting a new discussion on a mailing list, please do not reply to 
an existing message, instead start a fresh email.  Even if you change the 
subject line of your email, other mail headers still track which thread 
you replied to and your question is "hidden" in that thread and gets less 
attention.   It makes following discussions in the mailing list archives 
particularly difficult.



-Hoss

Re: Dynamically loading Elevation Info

Posted by Saroj C <sa...@tcs.com>.
Thanks Ravi and Eric. Will try these options.


Thanks and Regards,
Saroj Kumar Choudhury

____________________________________________
Experience certainty.   IT Services
                        Business Solutions
                        Outsourcing
____________________________________________



From:
Ravi Solr <ra...@gmail.com>
To:
"solr-user@lucene.apache.org" <so...@lucene.apache.org>
Date:
22-04-2013 23:27
Subject:
Re: Dynamically loading Elevation Info



If you place the elevate.xml in the data directory of your index it will 
be
loaded every time a commit happens.

Thanks

Ravi Kiran Bhaskar


On Mon, Apr 22, 2013 at 7:38 AM, Erick Erickson 
<er...@gmail.com>wrote:

> I believe (but don't know for sure) that the QEV file is re-read on
> core reload, which the same app that modifies the elevator.xml file
> could trigger with an http request, see:
>
> http://wiki.apache.org/solr/CoreAdmin#RELOAD
>
> At least that's what I would try first.
>
> Best
> Erick
>
> On Mon, Apr 22, 2013 at 2:48 AM, Saroj C <sa...@tcs.com> wrote:
> > Hi,
> >  Business User wants to configure the elevation text and the IDs and 
they
> > want to have an UI to do the same. As soon as they configure, it 
should
> be
> > reflected  in SOLR,(without restarting).
> >
> > My understanding is, Now, the QueryElevationComponent reads the
> > Elevator.xml(Configurable) and loads the information into 
ElevationCache
> > during startup and uses the information while responding to queries. 
Is
> > there any way, the content in the ElevationCache can be modifiable  by
> > some other external process / is there any easy way of achieving this
> > requirement ?
> >
> > Thanks and Regards,
> > Saroj Kumar Choudhury
> > =====-----=====-----=====
> > Notice: The information contained in this e-mail
> > message and/or attachments to it may contain
> > confidential or privileged information. If you are
> > not the intended recipient, any dissemination, use,
> > review, distribution, printing or copying of the
> > information contained in this e-mail message
> > and/or attachments to it are strictly prohibited. If
> > you have received this communication in error,
> > please notify us by reply e-mail or telephone and
> > immediately and permanently delete the message
> > and any attachments. Thank you
> >
> >
>



Re: Dynamically loading Elevation Info

Posted by Ravi Solr <ra...@gmail.com>.
If you place the elevate.xml in the data directory of your index it will be
loaded every time a commit happens.

Thanks

Ravi Kiran Bhaskar


On Mon, Apr 22, 2013 at 7:38 AM, Erick Erickson <er...@gmail.com>wrote:

> I believe (but don't know for sure) that the QEV file is re-read on
> core reload, which the same app that modifies the elevator.xml file
> could trigger with an http request, see:
>
> http://wiki.apache.org/solr/CoreAdmin#RELOAD
>
> At least that's what I would try first.
>
> Best
> Erick
>
> On Mon, Apr 22, 2013 at 2:48 AM, Saroj C <sa...@tcs.com> wrote:
> > Hi,
> >  Business User wants to configure the elevation text and the IDs and they
> > want to have an UI to do the same. As soon as they configure, it should
> be
> > reflected  in SOLR,(without restarting).
> >
> > My understanding is, Now, the QueryElevationComponent reads the
> > Elevator.xml(Configurable) and loads the information into ElevationCache
> > during startup and uses the information while responding to queries. Is
> > there any way, the content in the ElevationCache can be modifiable  by
> > some other external process / is there any easy way of achieving this
> > requirement ?
> >
> > Thanks and Regards,
> > Saroj Kumar Choudhury
> > =====-----=====-----=====
> > Notice: The information contained in this e-mail
> > message and/or attachments to it may contain
> > confidential or privileged information. If you are
> > not the intended recipient, any dissemination, use,
> > review, distribution, printing or copying of the
> > information contained in this e-mail message
> > and/or attachments to it are strictly prohibited. If
> > you have received this communication in error,
> > please notify us by reply e-mail or telephone and
> > immediately and permanently delete the message
> > and any attachments. Thank you
> >
> >
>

Re: Dynamically loading Elevation Info

Posted by Erick Erickson <er...@gmail.com>.
I believe (but don't know for sure) that the QEV file is re-read on
core reload, which the same app that modifies the elevator.xml file
could trigger with an http request, see:

http://wiki.apache.org/solr/CoreAdmin#RELOAD

At least that's what I would try first.

Best
Erick

On Mon, Apr 22, 2013 at 2:48 AM, Saroj C <sa...@tcs.com> wrote:
> Hi,
>  Business User wants to configure the elevation text and the IDs and they
> want to have an UI to do the same. As soon as they configure, it should be
> reflected  in SOLR,(without restarting).
>
> My understanding is, Now, the QueryElevationComponent reads the
> Elevator.xml(Configurable) and loads the information into ElevationCache
> during startup and uses the information while responding to queries. Is
> there any way, the content in the ElevationCache can be modifiable  by
> some other external process / is there any easy way of achieving this
> requirement ?
>
> Thanks and Regards,
> Saroj Kumar Choudhury
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>

Dynamically loading Elevation Info

Posted by Saroj C <sa...@tcs.com>.
Hi,
 Business User wants to configure the elevation text and the IDs and they 
want to have an UI to do the same. As soon as they configure, it should be 
reflected  in SOLR,(without restarting). 

My understanding is, Now, the QueryElevationComponent reads the 
Elevator.xml(Configurable) and loads the information into ElevationCache 
during startup and uses the information while responding to queries. Is 
there any way, the content in the ElevationCache can be modifiable  by 
some other external process / is there any easy way of achieving this 
requirement ?

Thanks and Regards,
Saroj Kumar Choudhury
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you



Re: is phrase search possible in solr

Posted by Jack Krupansky <ja...@basetechnology.com>.
"I want queries within double quotes to be ..."

Just to be clear (as already stated), you do not get to set the semantics of 
quotes, which are set by the query parser and the analyzer for the field - 
if you want a different semantics, copy the data to another field and use 
that different semantics in the new field's analyzer.

But also to be clear, in case anybody is simply reading the message subject 
line literally, yes, phrase search is possible in Solr.

-- Jack Krupansky

-----Original Message----- 
From: vicky desai
Sent: Monday, April 22, 2013 1:50 AM
To: solr-user@lucene.apache.org
Subject: Re: is phrase search possible in solr

Hi,

If I use shinglingFilter than all type of queries will be impacted. I want
queries within double quotes to be an exact search but for queries without
double quotes all analyzers and tokenizers should be applied. Is there a
setting or a configuration in schema.xml which can cater this requirement



--
View this message in context: 
http://lucene.472066.n3.nabble.com/is-phrase-search-possible-in-solr-tp4057312p4057812.html
Sent from the Solr - User mailing list archive at Nabble.com. 


Re: is phrase search possible in solr

Posted by vicky desai <vi...@germinait.com>.
Hi,

If I use shinglingFilter than all type of queries will be impacted. I want
queries within double quotes to be an exact search but for queries without
double quotes all analyzers and tokenizers should be applied. Is there a
setting or a configuration in schema.xml which can cater this requirement 



--
View this message in context: http://lucene.472066.n3.nabble.com/is-phrase-search-possible-in-solr-tp4057312p4057812.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: is phrase search possible in solr

Posted by qibaoyuan <qi...@gmail.com>.
Shingling filter may be help.

> I want to do a phrase search in solr without analyzers being applied to it 
> eg - If I search for *"DelhiDareDevil"* (i.e - with inverted commas)it
> should search the exact text and not apply any analyzers or tokenizers on
> this field
> However if i search for *DelhiDareDevil* it should use tokenizers and
> analyzers and split it to something like this *delhi dare devil*
> 
> My schema definition for this is as follows
> 
>    <fieldType name="text" class="solr.TextField"
>    			positionIncrementGap="100" autoGeneratePhraseQueries="false">
>    			<analyzer type="index">
>    				<tokenizer class="solr.WhitespaceTokenizerFactory" />
>    				<filter class="solr.WordDelimiterFilterFactory"
>    					generateWordParts="1" generateNumberParts="1" catenateWords="1"
>    					catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"
> preserveOriginal="1"/>
>    				<filter class="solr.LowerCaseFilterFactory" />
>    			</analyzer>
>    			<analyzer type="query">
>    				<tokenizer class="solr.WhitespaceTokenizerFactory" />
>    				<filter class="solr.WordDelimiterFilterFactory"
>    					generateWordParts="1" generateNumberParts="1" catenateWords="1"
>    					catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"
> preserveOriginal="1"/>
>    				<filter class="solr.LowerCaseFilter``Factory" />
>    			</analyzer>
>    		</fieldType>
> 
>    <field name="cContent" type="text" indexed="true" stored="true"
> multiValued="false"/>
> 
> any help would be appreciated
> 
> 
> 
> 
> --
> View this message in context: http://lucene.472066.n3.nabble.com/is-phrase-search-possible-in-solr-tp4057312.html
> Sent from the Solr - User mailing list archive at Nabble.com.


Re: is phrase search possible in solr

Posted by vicky desai <vi...@germinait.com>.
Hi,

Agreed it is a typo. And yes I can use one set of analyzers and tokenizers
for query as well as indexing but that too will not solve my problem



--
View this message in context: http://lucene.472066.n3.nabble.com/is-phrase-search-possible-in-solr-tp4057312p4057802.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: is phrase search possible in solr

Posted by Raymond Wiker <rw...@gmail.com>.
On Apr 19, 2013, at 16:59 , vicky desai <vi...@germinait.com> wrote:
> I want to do a phrase search in solr without analyzers being applied to it 
> eg - If I search for *"DelhiDareDevil"* (i.e - with inverted commas)it
> should search the exact text and not apply any analyzers or tokenizers on
> this field
> However if i search for *DelhiDareDevil* it should use tokenizers and
> analyzers and split it to something like this *delhi dare devil*
> 
> My schema definition for this is as follows
> 
>    <fieldType name="text" class="solr.TextField"
>    			positionIncrementGap="100" autoGeneratePhraseQueries="false">
>    			<analyzer type="index">
>    				<tokenizer class="solr.WhitespaceTokenizerFactory" />
>    				<filter class="solr.WordDelimiterFilterFactory"
>    					generateWordParts="1" generateNumberParts="1" catenateWords="1"
>    					catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"
> preserveOriginal="1"/>
>    				<filter class="solr.LowerCaseFilterFactory" />
>    			</analyzer>
>    			<analyzer type="query">
>    				<tokenizer class="solr.WhitespaceTokenizerFactory" />
>    				<filter class="solr.WordDelimiterFilterFactory"
>    					generateWordParts="1" generateNumberParts="1" catenateWords="1"
>    					catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"
> preserveOriginal="1"/>
>    				<filter class="solr.LowerCaseFilter``Factory" />
>    			</analyzer>
>    		</fieldType>
> 
>    <field name="cContent" type="text" indexed="true" stored="true"
> multiValued="false"/>
> 
> any help would be appreciated


First of all, it appears that you have a typo in the definition for the LowerCaseFilter for the query analyzer.

Secondly, as the two analyzers appear to be identical (except forn the probable typo), I think you could just specify it once, without specifying the type.



Re: is phrase search possible in solr

Posted by Erick Erickson <er...@gmail.com>.
bq: wherein if I have a query in double quotes it simply ignores all the
tokenizers and analyzers.

Nope. In general you're quite right, you need to re-index whenever you
change your schema... You could define the query part of your field
to just use KeywordTokenizerFactory, but that would affect _all_ queries
which doesn't work for your case..

You might be able to spoof things with, say, the "raw" query parser, see:
http://wiki.apache.org/solr/SolrQuerySyntax
or perhaps the "term" query, but I think you'll have some issues here if you
need to have more than one term next to each other (i.e. phrases). And
you'll have to handle all the upstream bits yourself, e.g. making sure
casing matches.  DelhiDareDevil is indexed as delhidaredevil for instance.

You could write your own query parser that handled this as a special
case, but that would involve quite a lot of work.

Best
Erick

On Mon, Apr 22, 2013 at 1:02 AM, vicky desai <vi...@germinait.com> wrote:
> Hi Jack,
>
> Making a changes in the schema either keyword tokenizer or copy field option
> which u suggested would require reindexing of entire data. Is there an
> option wherein if I have a query in double quotes it simply ignores all the
> tokenizers and analyzers.
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/is-phrase-search-possible-in-solr-tp4057312p4057804.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Re: is phrase search possible in solr

Posted by vicky desai <vi...@germinait.com>.
Hi Jack,

Making a changes in the schema either keyword tokenizer or copy field option
which u suggested would require reindexing of entire data. Is there an
option wherein if I have a query in double quotes it simply ignores all the
tokenizers and analyzers. 



--
View this message in context: http://lucene.472066.n3.nabble.com/is-phrase-search-possible-in-solr-tp4057312p4057804.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: is phrase search possible in solr

Posted by Jack Krupansky <ja...@basetechnology.com>.
Oops... that's "query analyzer", not "index analyzer", so it's:

By definition, phrase search is one of two things: 1) match on a string
field literally, or 2) analyze as a sequence of tokens as per the field type
query analyzer.

-- Jack Krupansky

-----Original Message----- 
From: Jack Krupansky
Sent: Friday, April 19, 2013 11:14 AM
To: solr-user@lucene.apache.org
Subject: Re: is phrase search possible in solr

By definition, phrase search is one of two things: 1) match on a string
field literally, or 2) analyze as a sequence of tokens as per the field type
index analyzer.

You could use the keyword tokenizer to store the whole field as one string,
with filtering for the whole string. Or, just make it a string field and do
literal and wildcard matches.

You can use copyField to make copies of the same input data in multiple
fields, each with different analyzers. You would then need to specify which
field you want to search, whether literal or keyword.

-- Jack Krupansky

-----Original Message----- 
From: vicky desai
Sent: Friday, April 19, 2013 10:59 AM
To: solr-user@lucene.apache.org
Subject: is phrase search possible in solr

I want to do a phrase search in solr without analyzers being applied to it
eg - If I search for *"DelhiDareDevil"* (i.e - with inverted commas)it
should search the exact text and not apply any analyzers or tokenizers on
this field
However if i search for *DelhiDareDevil* it should use tokenizers and
analyzers and split it to something like this *delhi dare devil*

My schema definition for this is as follows

    <fieldType name="text" class="solr.TextField"
    positionIncrementGap="100" autoGeneratePhraseQueries="false">
    <analyzer type="index">
    <tokenizer class="solr.WhitespaceTokenizerFactory" />
    <filter class="solr.WordDelimiterFilterFactory"
    generateWordParts="1" generateNumberParts="1" catenateWords="1"
    catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"
preserveOriginal="1"/>
    <filter class="solr.LowerCaseFilterFactory" />
    </analyzer>
    <analyzer type="query">
    <tokenizer class="solr.WhitespaceTokenizerFactory" />
    <filter class="solr.WordDelimiterFilterFactory"
    generateWordParts="1" generateNumberParts="1" catenateWords="1"
    catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"
preserveOriginal="1"/>
    <filter class="solr.LowerCaseFilter``Factory" />
    </analyzer>
    </fieldType>

    <field name="cContent" type="text" indexed="true" stored="true"
multiValued="false"/>

any help would be appreciated




--
View this message in context:
http://lucene.472066.n3.nabble.com/is-phrase-search-possible-in-solr-tp4057312.html
Sent from the Solr - User mailing list archive at Nabble.com. 


Re: is phrase search possible in solr

Posted by Jack Krupansky <ja...@basetechnology.com>.
By definition, phrase search is one of two things: 1) match on a string 
field literally, or 2) analyze as a sequence of tokens as per the field type 
index analyzer.

You could use the keyword tokenizer to store the whole field as one string, 
with filtering for the whole string. Or, just make it a string field and do 
literal and wildcard matches.

You can use copyField to make copies of the same input data in multiple 
fields, each with different analyzers. You would then need to specify which 
field you want to search, whether literal or keyword.

-- Jack Krupansky

-----Original Message----- 
From: vicky desai
Sent: Friday, April 19, 2013 10:59 AM
To: solr-user@lucene.apache.org
Subject: is phrase search possible in solr

I want to do a phrase search in solr without analyzers being applied to it
eg - If I search for *"DelhiDareDevil"* (i.e - with inverted commas)it
should search the exact text and not apply any analyzers or tokenizers on
this field
However if i search for *DelhiDareDevil* it should use tokenizers and
analyzers and split it to something like this *delhi dare devil*

My schema definition for this is as follows

    <fieldType name="text" class="solr.TextField"
    positionIncrementGap="100" autoGeneratePhraseQueries="false">
    <analyzer type="index">
    <tokenizer class="solr.WhitespaceTokenizerFactory" />
    <filter class="solr.WordDelimiterFilterFactory"
    generateWordParts="1" generateNumberParts="1" catenateWords="1"
    catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"
preserveOriginal="1"/>
    <filter class="solr.LowerCaseFilterFactory" />
    </analyzer>
    <analyzer type="query">
    <tokenizer class="solr.WhitespaceTokenizerFactory" />
    <filter class="solr.WordDelimiterFilterFactory"
    generateWordParts="1" generateNumberParts="1" catenateWords="1"
    catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"
preserveOriginal="1"/>
    <filter class="solr.LowerCaseFilter``Factory" />
    </analyzer>
    </fieldType>

    <field name="cContent" type="text" indexed="true" stored="true"
multiValued="false"/>

any help would be appreciated




--
View this message in context: 
http://lucene.472066.n3.nabble.com/is-phrase-search-possible-in-solr-tp4057312.html
Sent from the Solr - User mailing list archive at Nabble.com.