You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-dev@xml.apache.org by Natalia Shilenkova <ns...@gmail.com> on 2007/10/20 03:34:59 UTC

Extention XPath function

Hi All,

There is a new XPath function available in Xindice.

Function: boolean ftcontains(string)

The ftcontains function returns true if text content of the context
node matches full text query passed as the argument, otherwise it
returns false. Text query syntax is the same as Lucene query syntax,
except it does not use fields (using fields does not cause errors when
parsing the query, but function will return false).

Example: Query //chapter/title[ftcontains('story')] will return all
<title> elements that contain word 'story'.

For XPath queries that use ftcontains function Xindice will attempt to
optimize the query by using LuceneIndexer, if it is available and has
a suitable pattern. If LuceneIndexer exists for the collection being
queried, even if there is no suitable pattern, its analyzer will be
used for query parsing and tokenizing node text content to produce
consistent results. If LuceneIndexer is not found, default analyzer
will be used (at this time it is SimpleAnalyzer).

Comments/feedback/suggestions about new functionality are appreciated :)

Regards,
Natalia

Re: Extention XPath function

Posted by Vadim Gritsenko <va...@reverycodes.com>.
Natalia Shilenkova wrote:
> On 10/22/07, Vadim Gritsenko <va...@reverycodes.com> wrote:
>>> For XPath queries that use ftcontains function Xindice will attempt to
>>> optimize the query by using LuceneIndexer, if it is available and has
>>> a suitable pattern. If LuceneIndexer exists for the collection being
>>> queried, even if there is no suitable pattern,
>> Does it also log this condition? I'd think at INFO level, say that indexer
>> available but this particular pattern is missing, so that user can check logs
>> and correct the situation.
> 
> This behavior is consistent with queries that may be using other types
> of indexers. If query uses starts-with function and there is no value
> indexer for that pattern, it will not be reported. Is there any reason
> to treat new function differently?

Well I think it depends on how heavy Lucene search is... Ok may be not at INFO, 
but what about DEBUG level? :)

I personally would like to see at least DEBUG message for the situation with 
'starts-with' function, too. And any other like that - were index can speed 
querying up significantly.

Vadim

Re: Extention XPath function

Posted by Natalia Shilenkova <ns...@gmail.com>.
On 10/22/07, Vadim Gritsenko <va...@reverycodes.com> wrote:
> > Text query syntax is the same as Lucene query syntax,
> > except it does not use fields (using fields does not cause errors when
> > parsing the query, but function will return false).
>
> Will it log this situation? Possibly, a WARNing?

No, currently it won't be logged. I agree it would be a good idea to
inform user somehow about this situation, except I'm not sure if it is
possible to do without going in depth of Lucene query parser.

> > For XPath queries that use ftcontains function Xindice will attempt to
> > optimize the query by using LuceneIndexer, if it is available and has
> > a suitable pattern. If LuceneIndexer exists for the collection being
> > queried, even if there is no suitable pattern,
>
> Does it also log this condition? I'd think at INFO level, say that indexer
> available but this particular pattern is missing, so that user can check logs
> and correct the situation.

This behavior is consistent with queries that may be using other types
of indexers. If query uses starts-with function and there is no value
indexer for that pattern, it will not be reported. Is there any reason
to treat new function differently?

Natalia

Re: Extention XPath function

Posted by Vadim Gritsenko <va...@reverycodes.com>.
Natalia Shilenkova wrote:
> Hi All,
> 
> There is a new XPath function available in Xindice.
> 
> Function: boolean ftcontains(string)
> 
> The ftcontains function returns true if text content of the context
> node matches full text query passed as the argument, otherwise it
> returns false.

Awesome! Couple of questions...


> Text query syntax is the same as Lucene query syntax,
> except it does not use fields (using fields does not cause errors when
> parsing the query, but function will return false).

Will it log this situation? Possibly, a WARNing?


> Example: Query //chapter/title[ftcontains('story')] will return all
> <title> elements that contain word 'story'.
> 
> For XPath queries that use ftcontains function Xindice will attempt to
> optimize the query by using LuceneIndexer, if it is available and has
> a suitable pattern. If LuceneIndexer exists for the collection being
> queried, even if there is no suitable pattern,

Does it also log this condition? I'd think at INFO level, say that indexer 
available but this particular pattern is missing, so that user can check logs 
and correct the situation.

Vadim


> its analyzer will be
> used for query parsing and tokenizing node text content to produce
> consistent results. If LuceneIndexer is not found, default analyzer
> will be used (at this time it is SimpleAnalyzer).
> 
> Comments/feedback/suggestions about new functionality are appreciated :)
> 
> Regards,
> Natalia