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 suren <gu...@yahoo.com> on 2013/12/27 20:03:26 UTC

adding wild card at the end of the text and search(like sql like search)

My field type is text and i am using WhitespaceTokenizer. I want to search
like SQL like search
ie I want to search for ORGANIZATION_NAME field
ORGANIZATION_NAM:"JOHNSON & SO"*

should return 
"JOHNSON & SON", "JOHNSON & SONS", "JOHNSON & SONS COMPANY"...

I tried 
ORGANIZATION_NAM:"JOHNSON &" AND ORGANIZATION_NAM:SON*
Problem with this is It will bring "SWANK & SON, INC. C/O EVELYN JOHNSON".
I want the result to be like SQL like search.




--
View this message in context: http://lucene.472066.n3.nabble.com/adding-wild-card-at-the-end-of-the-text-and-search-like-sql-like-search-tp4108399.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: adding wild card at the end of the text and search(like sql like search)

Posted by Andrea Gazzarini <a....@gmail.com>.
Hi Suren,
You could try a textfield with a WordDelimiter filter + EdgeNGram filter
(this latter only in the index analyzer). In this way your heading will be
indexed as

Jo
Joh
John
Johns
....
Johnsonso
Johnsonson
Johnsonsons

and a query for

Johnson & so

Will be translated into

Johnsonso

Therfore founding a match with one of the indexed tokens.

Best,
Andrea
On 27 Dec 2013 20:03, "suren" <gu...@yahoo.com> wrote:

> My field type is text and i am using WhitespaceTokenizer. I want to search
> like SQL like search
> ie I want to search for ORGANIZATION_NAME field
> ORGANIZATION_NAM:"JOHNSON & SO"*
>
> should return
> "JOHNSON & SON", "JOHNSON & SONS", "JOHNSON & SONS COMPANY"...
>
> I tried
> ORGANIZATION_NAM:"JOHNSON &" AND ORGANIZATION_NAM:SON*
> Problem with this is It will bring "SWANK & SON, INC. C/O EVELYN JOHNSON".
> I want the result to be like SQL like search.
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/adding-wild-card-at-the-end-of-the-text-and-search-like-sql-like-search-tp4108399.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: adding wild card at the end of the text and search(like sql like search)

Posted by Jack Krupansky <ja...@basetechnology.com>.
The defType parameter applies only to the q parameter, not to fq, so you 
will need to explicitly give the query parser for fq:

fq={!queryparsername}filterquery

-- Jack Krupansky

-----Original Message----- 
From: suren
Sent: Thursday, January 02, 2014 7:32 PM
To: solr-user@lucene.apache.org
Subject: Re: adding wild card at the end of the text and search(like sql 
like search)

Ahmet,
          It did not solve the problem. I added
1)ComplexPhrase-4.2.1.jar to my local solr
"solr-4.3.1\example\solr\collection1\lib"
2)added  the below content to "solrConfig.xml"
<queryParser name="unorderedcomplexphrase"
class="org.apache.solr.search.ComplexPhraseQParserPlugin">
    <bool name="inOrder">false</bool>
  </queryParser>
3)re-started solr, appended the Query param
"defType=unorderedcomplexphrase" and ran the query, still issue present.

http://localhost:8983/solr/collection1/select?q=*%3A*&fq=ORGANIZATION_NAM%3A%22JOHNSON+%26+SO*%22&wt=xml&indent=true&defType=unorderedcomplexphrase

Please let me know if i am missing anything?




--
View this message in context: 
http://lucene.472066.n3.nabble.com/adding-wild-card-at-the-end-of-the-text-and-search-like-sql-like-search-tp4108399p4109221.html
Sent from the Solr - User mailing list archive at Nabble.com. 


Re: adding wild card at the end of the text and search(like sql like search)

Posted by suren <gu...@yahoo.com>.
by using Q command and passing query parameter defType=unorderedcomplexphrase
it worked for me.

http://localhost:8999/solr/MACSearch/select?q=LAST_NAM%3A%22DE+PAR*%22%0A&wt=xml&indent=true&defType=unorderedcomplexphrase

Thanks.



--
View this message in context: http://lucene.472066.n3.nabble.com/adding-wild-card-at-the-end-of-the-text-and-search-like-sql-like-search-tp4108399p4109796.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: adding wild card at the end of the text and search(like sql like search)

Posted by Ahmet Arslan <io...@yahoo.com>.
Hi Suren,

Unfortunately what you did is not the way to activate it. You need to add ComplexPhrase-4.2.1.jar inside of solr.war file and re-package solr.war file. There is a detailed ReadMe.txt file inside the zip-ball. Please follow instructions written in ReadMe.txt file.

Ahmet



On Friday, January 3, 2014 2:32 AM, suren <gu...@yahoo.com> wrote:
Ahmet,
          It did not solve the problem. I added 
1)ComplexPhrase-4.2.1.jar to my local solr 
"solr-4.3.1\example\solr\collection1\lib" 
2)added  the below content to "solrConfig.xml"
<queryParser name="unorderedcomplexphrase"
class="org.apache.solr.search.ComplexPhraseQParserPlugin">
    <bool name="inOrder">false</bool>
  </queryParser>
3)re-started solr, appended the Query param 
"defType=unorderedcomplexphrase" and ran the query, still issue present. 

http://localhost:8983/solr/collection1/select?q=*%3A*&fq=ORGANIZATION_NAM%3A%22JOHNSON+%26+SO*%22&wt=xml&indent=true&defType=unorderedcomplexphrase

Please let me know if i am missing anything?




--
View this message in context: http://lucene.472066.n3.nabble.com/adding-wild-card-at-the-end-of-the-text-and-search-like-sql-like-search-tp4108399p4109221.html

Sent from the Solr - User mailing list archive at Nabble.com.


Re: adding wild card at the end of the text and search(like sql like search)

Posted by suren <gu...@yahoo.com>.
Ahmet,
          It did not solve the problem. I added 
1)ComplexPhrase-4.2.1.jar to my local solr 
"solr-4.3.1\example\solr\collection1\lib" 
2)added  the below content to "solrConfig.xml"
<queryParser name="unorderedcomplexphrase"
class="org.apache.solr.search.ComplexPhraseQParserPlugin">
    <bool name="inOrder">false</bool>
  </queryParser>
3)re-started solr, appended the Query param 
"defType=unorderedcomplexphrase" and ran the query, still issue present. 

http://localhost:8983/solr/collection1/select?q=*%3A*&fq=ORGANIZATION_NAM%3A%22JOHNSON+%26+SO*%22&wt=xml&indent=true&defType=unorderedcomplexphrase

Please let me know if i am missing anything?




--
View this message in context: http://lucene.472066.n3.nabble.com/adding-wild-card-at-the-end-of-the-text-and-search-like-sql-like-search-tp4108399p4109221.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: adding wild card at the end of the text and search(like sql like search)

Posted by Ahmet Arslan <io...@yahoo.com>.
Hi Suren,

Try ComplexPhrase-4.2.1.zip, there is a read me file inside it.

Ahmet


On Monday, December 30, 2013 8:21 PM, suren <gu...@yahoo.com> wrote:
Ahmet,
          I am using solr 4.3.1. do i still need to apply this patch ? if
yes please tell me the steps to follow. In the given link i see lot of
patches, not sure which patch for what version of solr also i don't see the
patch note how to apply.

Thanks,
Suren.




--
View this message in context: http://lucene.472066.n3.nabble.com/adding-wild-card-at-the-end-of-the-text-and-search-like-sql-like-search-tp4108399p4108765.html

Sent from the Solr - User mailing list archive at Nabble.com.


Re: adding wild card at the end of the text and search(like sql like search)

Posted by suren <gu...@yahoo.com>.
Ahmet,
          I am using solr 4.3.1. do i still need to apply this patch ? if
yes please tell me the steps to follow. In the given link i see lot of
patches, not sure which patch for what version of solr also i don't see the
patch note how to apply.

Thanks,
Suren.




--
View this message in context: http://lucene.472066.n3.nabble.com/adding-wild-card-at-the-end-of-the-text-and-search-like-sql-like-search-tp4108399p4108765.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: adding wild card at the end of the text and search(like sql like search)

Posted by Ahmet Arslan <io...@yahoo.com>.
Hi Suren,

With https://issues.apache.org/jira/browse/SOLR-1604 it is possible but it requires re-packaging solr.war. Your query will be : ORGANIZATION_NAM:"JOHNSON & SO*"


Ahmet


On Friday, December 27, 2013 9:03 PM, suren <gu...@yahoo.com> wrote:
My field type is text and i am using WhitespaceTokenizer. I want to search
like SQL like search
ie I want to search for ORGANIZATION_NAME field
ORGANIZATION_NAM:"JOHNSON & SO"*

should return 
"JOHNSON & SON", "JOHNSON & SONS", "JOHNSON & SONS COMPANY"...

I tried 
ORGANIZATION_NAM:"JOHNSON &" AND ORGANIZATION_NAM:SON*
Problem with this is It will bring "SWANK & SON, INC. C/O EVELYN JOHNSON".
I want the result to be like SQL like search.




--
View this message in context: http://lucene.472066.n3.nabble.com/adding-wild-card-at-the-end-of-the-text-and-search-like-sql-like-search-tp4108399.html
Sent from the Solr - User mailing list archive at Nabble.com.