You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by "Digy (JIRA)" <ji...@apache.org> on 2011/01/15 22:08:47 UTC

[jira] Closed: (LUCENENET-385) Searching string with Special charactor not working

     [ https://issues.apache.org/jira/browse/LUCENENET-385?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Digy closed LUCENENET-385.
--------------------------

    Resolution: Not A Problem

> Searching string with Special charactor not working
> ---------------------------------------------------
>
>                 Key: LUCENENET-385
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-385
>             Project: Lucene.Net
>          Issue Type: Task
>         Environment: .NET Framework 2.0+, C#.NET, ASP.NET, Webservices
>            Reporter: Abhilash C R
>
> I have came acroos an issue with search option in our application which uses Lucene.Net 2.0 version. 
> The scenario is if I try search a text "Test&&Test" (it is actually Test&&Test.doc, which is trying to search), it returns 0 hits. While debugging I could see that the line which wrote to Parse the query is giving the problem,
> Here is the error line code:
> Query
> q=null; 
> q = 
> new global::Lucene.Net.QueryParsers.QueryParser("content", new StandardAnalyzer()).Parse(query); 
>  The variable query at above point contains as this: 
> (title:(Test&&Test) shorttitle:(Test&&Test) content:(Test&&Test) keywords:(Test&&Test) description:(Test&&Test) )
> and q will get as this:
> title:"test test" shorttitle:"test test" content:"test test" keywords:"test test" description:"test test"
>  
> And hence the hit length will be 0 at 
> IndexSearcher searcher = new IndexSearcher(indexPath); 
> Hits hits = searcher.Search(q);
> I tried adding"\" before &&, tried escape, tried enclosing the text in a "" but all result the same outcome.
> Could anyone please hlep me with any fix to it?
> If require I can post the full code here.
> Hope to hear from Lucene.Net.
> Many thanks
> Abhilash 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Closed: (LUCENENET-385) Searching string with Special charactor not working

Posted by K a r n a v <ka...@gmail.com>.
even i tried the same..and faced the same prob......but i solved
differently.....while indexing i've replaced the special chars with
predefined special codes...and while searching ....i used the same mapping
table for special chars-to-codes....
ex: if search string is like  karunaker&&reddy

while indexing karunaker&&reddy...im manipulating & to MCAMP (MCAMP- mapping
code ampersand - my defined code)
so  the indexing string will be like karunakerMCAMPMCAMPreddy...
and while searching also..im using the same mapping table..so search string
also...karunakerMCAMPMCAMPreddy..
.....so....i can get the result..


thank you...

On Sun, Jan 16, 2011 at 2:38 AM, Digy (JIRA) <ji...@apache.org> wrote:

>
>     [
> https://issues.apache.org/jira/browse/LUCENENET-385?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]
>
> Digy closed LUCENENET-385.
> --------------------------
>
>    Resolution: Not A Problem
>
> > Searching string with Special charactor not working
> > ---------------------------------------------------
> >
> >                 Key: LUCENENET-385
> >                 URL: https://issues.apache.org/jira/browse/LUCENENET-385
> >             Project: Lucene.Net
> >          Issue Type: Task
> >         Environment: .NET Framework 2.0+, C#.NET, ASP.NET, Webservices
> >            Reporter: Abhilash C R
> >
> > I have came acroos an issue with search option in our application which
> uses Lucene.Net 2.0 version.
> > The scenario is if I try search a text "Test&&Test" (it is actually
> Test&&Test.doc, which is trying to search), it returns 0 hits. While
> debugging I could see that the line which wrote to Parse the query is giving
> the problem,
> > Here is the error line code:
> > Query
> > q=null;
> > q =
> > new global::Lucene.Net.QueryParsers.QueryParser("content", new
> StandardAnalyzer()).Parse(query);
> >  The variable query at above point contains as this:
> > (title:(Test&&Test) shorttitle:(Test&&Test) content:(Test&&Test)
> keywords:(Test&&Test) description:(Test&&Test) )
> > and q will get as this:
> > title:"test test" shorttitle:"test test" content:"test test"
> keywords:"test test" description:"test test"
> >
> > And hence the hit length will be 0 at
> > IndexSearcher searcher = new IndexSearcher(indexPath);
> > Hits hits = searcher.Search(q);
> > I tried adding"\" before &&, tried escape, tried enclosing the text in a
> "" but all result the same outcome.
> > Could anyone please hlep me with any fix to it?
> > If require I can post the full code here.
> > Hope to hear from Lucene.Net.
> > Many thanks
> > Abhilash
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>


-- 
*Thanks & Regards*,
*Karunaker Reddy V

*http://www.flickr.com/photos/karnav/

*Ooh!!*, and one more thing: *no matter who you are, you were built to be
brilliant and designed to make a difference in this world*.* PLEASE DOT IT*!