You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lucenenet.apache.org by Giovanni Caputo <gi...@gmail.com> on 2010/02/23 12:54:46 UTC

text as query of search

Hi,
how  can i get documents similar to a long text??

I am using lucene.net 2.4

I have tested to use Query query = parser.Parse(ua.TestoCompleto);
where ua.TestoCompleto is a String


I have created QueryParser parser = new QueryParser(INDEX_PATH, analyzer);
as same mode of indexwriter


but it generate this exception

A first chance exception of type 'Lucene.Net.QueryParsers.ParseException' occurred in Lucene.Net.dll
Encountered ":" at line 1, column 0.
Was expecting one of:
    <NOT> ...
    "+" ...
    "-" ...
    "(" ...
    <QUOTED> ...
    <TERM> ...
    <PREFIXTERM> ...
    <WILDTERM> ...
    "[" ...
    "{" ...
    <NUMBER> ...



RE: text as query of search

Posted by Digy <di...@gmail.com>.
You can try Similarity.Net. it is available at
https://svn.apache.org/repos/asf/lucene/lucene.net/trunk/C#/contrib/Similari
ty.Net

DIGY


-----Original Message-----
From: Giovanni Caputo [mailto:giovannicaputo86@gmail.com] 
Sent: Tuesday, February 23, 2010 4:54 PM
To: lucene-net-user@lucene.apache.org
Subject: Re: text as query of search

Yes, I can use doc for see not-allowed characters....
but why i must specify Analyzer on QueryParser 
if it is not used?

There are other mode for obtain similar documents to new document?


Thanks very much


Il giorno 23/feb/2010, alle ore 15.42, Heath Aldrich ha scritto:

> Take a look in the docs for restricted characters.
> I don't recall for certain, but I believe the ":" is not allowed to be in
your search string.
> 
> A ":" is normally used when you're indicating what field to search.  E.g.
SEARCHFIELD:search string
> 
> You'll find several characters are not allowed... I'd advise you to check
in the docs (or even the java lucene docs), there is quite a bit of info
about restricted or non-allowed characters.
> 
> 
> -----Original Message-----
> From: Giovanni Caputo [mailto:giovannicaputo86@gmail.com] 
> Sent: Tuesday, February 23, 2010 8:31 AM
> To: lucene-net-user@lucene.apache.org
> Subject: Re: text as query of search
> 
> I don't understand you...
> I want a list of similary documents of new document. 
> 
> 
> I have seen the text of new document and there are ":" ... this character
give problem...
> 
> But also other caracter, for example "(" can make problem...
> 
> Ho can resolve this problem??
> Thanks
> 
> 
> 
> 
> 
> Il giorno 23/feb/2010, alle ore 14.10, Heath Aldrich ha scritto:
> 
>> Sounds like perhaps you passed a colon in as part of your search string.
>> 
>> Sent from my mobile phone.
>> Please excuse any spelling or gramatical errors.
>> 
>> On Feb 23, 2010, at 5:59 AM, "Giovanni Caputo"
<giovannicaputo86@gmail.com 
>>> wrote:
>> 
>>> 
>>> 
>>> Inizio messaggio inoltrato:
>>> 
>>>> Da: Giovanni Caputo <gi...@gmail.com>
>>>> Data: 23 febbraio 2010 12.54.46 GMT+01.00
>>>> A: lucene-net-user@lucene.apache.org, george@aroush.net,
digydigy@gmail.com 
>>>> , dsale@myspace-inc.com, mgarski@myspace-inc.com
>>>> Oggetto: text as query of search
>>>> 
>>>> Hi,
>>>> how  can i get documents similar to a long text??
>>>> 
>>>> I am using lucene.net 2.4
>>>> 
>>>> I have tested to use Query query = parser.Parse(ua.TestoCompleto);
>>>> where ua.TestoCompleto is a String
>>>> 
>>>> 
>>>> I have created QueryParser parser = new QueryParser(INDEX_PATH,  
>>>> analyzer);
>>>> as same mode of indexwriter
>>>> 
>>>> 
>>>> but it generate this exception
>>>> 
>>>> A first chance exception of type  
>>>> 'Lucene.Net.QueryParsers.ParseException' occurred in Lucene.Net.dll
>>>> Encountered ":" at line 1, column 0.
>>>> Was expecting one of:
>>>>  <NOT> ...
>>>>  "+" ...
>>>>  "-" ...
>>>>  "(" ...
>>>>  <QUOTED> ...
>>>>  <TERM> ...
>>>>  <PREFIXTERM> ...
>>>>  <WILDTERM> ...
>>>>  "[" ...
>>>>  "{" ...
>>>>  <NUMBER> ...
>>>> 
>>>> 
>>> 
>> 
> 
> 
> 



Re: text as query of search

Posted by Giovanni Caputo <gi...@gmail.com>.
Yes, I can use doc for see not-allowed characters....
but why i must specify Analyzer on QueryParser 
if it is not used?

There are other mode for obtain similar documents to new document?


Thanks very much


Il giorno 23/feb/2010, alle ore 15.42, Heath Aldrich ha scritto:

> Take a look in the docs for restricted characters.
> I don't recall for certain, but I believe the ":" is not allowed to be in your search string.
> 
> A ":" is normally used when you're indicating what field to search.  E.g.  SEARCHFIELD:search string
> 
> You'll find several characters are not allowed... I'd advise you to check in the docs (or even the java lucene docs), there is quite a bit of info about restricted or non-allowed characters.
> 
> 
> -----Original Message-----
> From: Giovanni Caputo [mailto:giovannicaputo86@gmail.com] 
> Sent: Tuesday, February 23, 2010 8:31 AM
> To: lucene-net-user@lucene.apache.org
> Subject: Re: text as query of search
> 
> I don't understand you...
> I want a list of similary documents of new document. 
> 
> 
> I have seen the text of new document and there are ":" ... this character give problem...
> 
> But also other caracter, for example "(" can make problem...
> 
> Ho can resolve this problem??
> Thanks
> 
> 
> 
> 
> 
> Il giorno 23/feb/2010, alle ore 14.10, Heath Aldrich ha scritto:
> 
>> Sounds like perhaps you passed a colon in as part of your search string.
>> 
>> Sent from my mobile phone.
>> Please excuse any spelling or gramatical errors.
>> 
>> On Feb 23, 2010, at 5:59 AM, "Giovanni Caputo" <giovannicaputo86@gmail.com 
>>> wrote:
>> 
>>> 
>>> 
>>> Inizio messaggio inoltrato:
>>> 
>>>> Da: Giovanni Caputo <gi...@gmail.com>
>>>> Data: 23 febbraio 2010 12.54.46 GMT+01.00
>>>> A: lucene-net-user@lucene.apache.org, george@aroush.net, digydigy@gmail.com 
>>>> , dsale@myspace-inc.com, mgarski@myspace-inc.com
>>>> Oggetto: text as query of search
>>>> 
>>>> Hi,
>>>> how  can i get documents similar to a long text??
>>>> 
>>>> I am using lucene.net 2.4
>>>> 
>>>> I have tested to use Query query = parser.Parse(ua.TestoCompleto);
>>>> where ua.TestoCompleto is a String
>>>> 
>>>> 
>>>> I have created QueryParser parser = new QueryParser(INDEX_PATH,  
>>>> analyzer);
>>>> as same mode of indexwriter
>>>> 
>>>> 
>>>> but it generate this exception
>>>> 
>>>> A first chance exception of type  
>>>> 'Lucene.Net.QueryParsers.ParseException' occurred in Lucene.Net.dll
>>>> Encountered ":" at line 1, column 0.
>>>> Was expecting one of:
>>>>  <NOT> ...
>>>>  "+" ...
>>>>  "-" ...
>>>>  "(" ...
>>>>  <QUOTED> ...
>>>>  <TERM> ...
>>>>  <PREFIXTERM> ...
>>>>  <WILDTERM> ...
>>>>  "[" ...
>>>>  "{" ...
>>>>  <NUMBER> ...
>>>> 
>>>> 
>>> 
>> 
> 
> 
> 


RE: text as query of search

Posted by Heath Aldrich <ha...@aes2.com>.
Take a look in the docs for restricted characters.
I don't recall for certain, but I believe the ":" is not allowed to be in your search string.

A ":" is normally used when you're indicating what field to search.  E.g.  SEARCHFIELD:search string

You'll find several characters are not allowed... I'd advise you to check in the docs (or even the java lucene docs), there is quite a bit of info about restricted or non-allowed characters.


-----Original Message-----
From: Giovanni Caputo [mailto:giovannicaputo86@gmail.com] 
Sent: Tuesday, February 23, 2010 8:31 AM
To: lucene-net-user@lucene.apache.org
Subject: Re: text as query of search

I don't understand you...
I want a list of similary documents of new document. 


I have seen the text of new document and there are ":" ... this character give problem...

But also other caracter, for example "(" can make problem...

Ho can resolve this problem??
Thanks





Il giorno 23/feb/2010, alle ore 14.10, Heath Aldrich ha scritto:

> Sounds like perhaps you passed a colon in as part of your search string.
> 
> Sent from my mobile phone.
> Please excuse any spelling or gramatical errors.
> 
> On Feb 23, 2010, at 5:59 AM, "Giovanni Caputo" <giovannicaputo86@gmail.com 
>> wrote:
> 
>> 
>> 
>> Inizio messaggio inoltrato:
>> 
>>> Da: Giovanni Caputo <gi...@gmail.com>
>>> Data: 23 febbraio 2010 12.54.46 GMT+01.00
>>> A: lucene-net-user@lucene.apache.org, george@aroush.net, digydigy@gmail.com 
>>> , dsale@myspace-inc.com, mgarski@myspace-inc.com
>>> Oggetto: text as query of search
>>> 
>>> Hi,
>>> how  can i get documents similar to a long text??
>>> 
>>> I am using lucene.net 2.4
>>> 
>>> I have tested to use Query query = parser.Parse(ua.TestoCompleto);
>>> where ua.TestoCompleto is a String
>>> 
>>> 
>>> I have created QueryParser parser = new QueryParser(INDEX_PATH,  
>>> analyzer);
>>> as same mode of indexwriter
>>> 
>>> 
>>> but it generate this exception
>>> 
>>> A first chance exception of type  
>>> 'Lucene.Net.QueryParsers.ParseException' occurred in Lucene.Net.dll
>>> Encountered ":" at line 1, column 0.
>>> Was expecting one of:
>>>   <NOT> ...
>>>   "+" ...
>>>   "-" ...
>>>   "(" ...
>>>   <QUOTED> ...
>>>   <TERM> ...
>>>   <PREFIXTERM> ...
>>>   <WILDTERM> ...
>>>   "[" ...
>>>   "{" ...
>>>   <NUMBER> ...
>>> 
>>> 
>> 
> 




Re: text as query of search

Posted by Giovanni Caputo <gi...@gmail.com>.
I don't understand you...
I want a list of similary documents of new document. 


I have seen the text of new document and there are ":" ... this character give problem...

But also other caracter, for example "(" can make problem...

Ho can resolve this problem??
Thanks





Il giorno 23/feb/2010, alle ore 14.10, Heath Aldrich ha scritto:

> Sounds like perhaps you passed a colon in as part of your search string.
> 
> Sent from my mobile phone.
> Please excuse any spelling or gramatical errors.
> 
> On Feb 23, 2010, at 5:59 AM, "Giovanni Caputo" <giovannicaputo86@gmail.com 
>> wrote:
> 
>> 
>> 
>> Inizio messaggio inoltrato:
>> 
>>> Da: Giovanni Caputo <gi...@gmail.com>
>>> Data: 23 febbraio 2010 12.54.46 GMT+01.00
>>> A: lucene-net-user@lucene.apache.org, george@aroush.net, digydigy@gmail.com 
>>> , dsale@myspace-inc.com, mgarski@myspace-inc.com
>>> Oggetto: text as query of search
>>> 
>>> Hi,
>>> how  can i get documents similar to a long text??
>>> 
>>> I am using lucene.net 2.4
>>> 
>>> I have tested to use Query query = parser.Parse(ua.TestoCompleto);
>>> where ua.TestoCompleto is a String
>>> 
>>> 
>>> I have created QueryParser parser = new QueryParser(INDEX_PATH,  
>>> analyzer);
>>> as same mode of indexwriter
>>> 
>>> 
>>> but it generate this exception
>>> 
>>> A first chance exception of type  
>>> 'Lucene.Net.QueryParsers.ParseException' occurred in Lucene.Net.dll
>>> Encountered ":" at line 1, column 0.
>>> Was expecting one of:
>>>   <NOT> ...
>>>   "+" ...
>>>   "-" ...
>>>   "(" ...
>>>   <QUOTED> ...
>>>   <TERM> ...
>>>   <PREFIXTERM> ...
>>>   <WILDTERM> ...
>>>   "[" ...
>>>   "{" ...
>>>   <NUMBER> ...
>>> 
>>> 
>> 
> 


Re: text as query of search

Posted by Heath Aldrich <ha...@aes2.com>.
Sounds like perhaps you passed a colon in as part of your search string.

Sent from my mobile phone.
Please excuse any spelling or gramatical errors.

On Feb 23, 2010, at 5:59 AM, "Giovanni Caputo" <giovannicaputo86@gmail.com 
 > wrote:

>
>
> Inizio messaggio inoltrato:
>
>> Da: Giovanni Caputo <gi...@gmail.com>
>> Data: 23 febbraio 2010 12.54.46 GMT+01.00
>> A: lucene-net-user@lucene.apache.org, george@aroush.net, digydigy@gmail.com 
>> , dsale@myspace-inc.com, mgarski@myspace-inc.com
>> Oggetto: text as query of search
>>
>> Hi,
>> how  can i get documents similar to a long text??
>>
>> I am using lucene.net 2.4
>>
>> I have tested to use Query query = parser.Parse(ua.TestoCompleto);
>> where ua.TestoCompleto is a String
>>
>>
>> I have created QueryParser parser = new QueryParser(INDEX_PATH,  
>> analyzer);
>> as same mode of indexwriter
>>
>>
>> but it generate this exception
>>
>> A first chance exception of type  
>> 'Lucene.Net.QueryParsers.ParseException' occurred in Lucene.Net.dll
>> Encountered ":" at line 1, column 0.
>> Was expecting one of:
>>    <NOT> ...
>>    "+" ...
>>    "-" ...
>>    "(" ...
>>    <QUOTED> ...
>>    <TERM> ...
>>    <PREFIXTERM> ...
>>    <WILDTERM> ...
>>    "[" ...
>>    "{" ...
>>    <NUMBER> ...
>>
>>
>


Fwd: text as query of search

Posted by Giovanni Caputo <gi...@gmail.com>.

Inizio messaggio inoltrato:

> Da: Giovanni Caputo <gi...@gmail.com>
> Data: 23 febbraio 2010 12.54.46 GMT+01.00
> A: lucene-net-user@lucene.apache.org, george@aroush.net, digydigy@gmail.com, dsale@myspace-inc.com, mgarski@myspace-inc.com
> Oggetto: text as query of search
> 
> Hi,
> how  can i get documents similar to a long text??
> 
> I am using lucene.net 2.4
> 
> I have tested to use Query query = parser.Parse(ua.TestoCompleto);
> where ua.TestoCompleto is a String
> 
> 
> I have created QueryParser parser = new QueryParser(INDEX_PATH, analyzer);
> as same mode of indexwriter
> 
> 
> but it generate this exception
> 
> A first chance exception of type 'Lucene.Net.QueryParsers.ParseException' occurred in Lucene.Net.dll
> Encountered ":" at line 1, column 0.
> Was expecting one of:
>     <NOT> ...
>     "+" ...
>     "-" ...
>     "(" ...
>     <QUOTED> ...
>     <TERM> ...
>     <PREFIXTERM> ...
>     <WILDTERM> ...
>     "[" ...
>     "{" ...
>     <NUMBER> ...
> 
>