Analyzing SpanNearQuery


(Niko) #1

Hi everyone,

I have a question regarding SpanNearQueries. As I saw Term Queries
were not analyzed before search, but are SpanNearQueries? Is there a
way to analyze the SpanTermQueries inside of SpanNearQueries using the
analyzer defined in the field mapping.

Thanks in advance.

Cheers,
Niko


(Clinton Gormley) #2

Hi Niko

I have a question regarding SpanNearQueries. As I saw Term Queries
were not analyzed before search, but are SpanNearQueries? Is there a
way to analyze the SpanTermQueries inside of SpanNearQueries using the
analyzer defined in the field mapping.

Span queries are not analyzed either.

clint


(Niko) #3

Hi Clint,

okay, is there a way to workaround? We would like to have analyzed terms
within the SpanQuery, or is the only way to analyze by hand and put the
terms then back into the SpanQuery?

Niko

2011/6/29 Clinton Gormley clinton@iannounce.co.uk

Hi Niko

I have a question regarding SpanNearQueries. As I saw Term Queries
were not analyzed before search, but are SpanNearQueries? Is there a
way to analyze the SpanTermQueries inside of SpanNearQueries using the
analyzer defined in the field mapping.

Span queries are not analyzed either.

clint

--

Gruß

Niko Gross


(Clinton Gormley) #4

Hi Niko

okay, is there a way to workaround? We would like to have analyzed
terms within the SpanQuery, or is the only way to analyze by hand and
put the terms then back into the SpanQuery?

Yes, I'm afraid that's the only way.

One way that you could approach it is to use the 'analyze' API. So you
pass your text to ES, get the analyzed results back, then use those.

Not sure it is the most efficient way of doing it though.

http://www.elasticsearch.org/guide/reference/api/admin-indices-analyze.html

clint


(Niko) #5

Hi,

ok thanks. That what we thought we have to do.

Niko

2011/6/29 Clinton Gormley clinton@iannounce.co.uk

Hi Niko

okay, is there a way to workaround? We would like to have analyzed
terms within the SpanQuery, or is the only way to analyze by hand and
put the terms then back into the SpanQuery?

Yes, I'm afraid that's the only way.

One way that you could approach it is to use the 'analyze' API. So you
pass your text to ES, get the analyzed results back, then use those.

Not sure it is the most efficient way of doing it though.

http://www.elasticsearch.org/guide/reference/api/admin-indices-analyze.html

clint

--

Gruß

Niko Gross


#6

Hi all,

I just found this forum thread which is related to my problem.
Is there anything new in Elasticsearch to avoid the workaround proposed by Clinton (as far as I know, it is not the case)?
Maybe an enhancement to the workaround is to create a plugin on the ES side that does the analysis in order to avoid a query to the analysis API from the client side. Is it a correct approach?

Thanks,


(Ivan Brusic) #7

If you using Java, I used to use the analysis service locally using the
TransportClient. Not sure that is even possible, since so many useful
workarounds have been closed. The issue does not stem from Elasticsearch,
but Lucene, since that is where the limitation is.


#8

Thank you,

I'll try this approach.


(Ivan Brusic) #9

It should be clear that when I said the issue is in Lucene, I mean the need
to pre-analyze tokens.

It used to be easy to create your own AnalysisService locally (if using the
Java client), but I might have gotten difficult with each new version of
Elasticsearch. I have not SpanQueries since 1.x. Just look at any unit
tests for the analysis chain such as CharFilterTests:

2.4:

5.0:

master:
https://github.com/elastic/elasticsearch/blob/master/core/src/test/java/org/elasticsearch/index/analysis/CharFilterTests.java#L42

In 2.x, all you needed was the injector. Now it seems that you cannot even
create the AnalysisService (have not fully explored the new code).

Cheers,

Ivan


(system) #10