Re: is phrase search possible in solr

2013-04-22 Thread Erick Erickson
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 vicky.de...@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

2013-04-22 Thread Jack Krupansky

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

2013-04-21 Thread vicky desai
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

2013-04-21 Thread vicky desai
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

2013-04-21 Thread qibaoyuan

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

2013-04-21 Thread vicky desai
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.


is phrase search possible in solr

2013-04-19 Thread vicky desai
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

2013-04-19 Thread Raymond Wiker
On Apr 19, 2013, at 16:59 , vicky desai vicky.de...@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

2013-04-19 Thread Jack Krupansky
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

2013-04-19 Thread Jack Krupansky

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.