LuceneAuditor - unable to search by exact property value
--------------------------------------------------------

                 Key: SMX4NMR-237
                 URL: https://issues.apache.org/activemq/browse/SMX4NMR-237
             Project: ServiceMix NMR
          Issue Type: Bug
    Affects Versions: 1.3.0
            Reporter: Albert Tumanov
            Assignee: Guillaume Nodet


When exchange contains a property like:

  properties: [
      correlationId = aec94f2c-8763-4bd0-938d-e9cbb8d36a74
  ]

and LuceneAuditor is configured to log the exchange, the log is created but not 
searchable:

s...@root> audit:find "correlationId:aec94f2c-8763-4bd0-938d-e9cbb8d36a74"
No matching exchanges


The reason is that LuceneAuditor uses Field.Index.ANALYZED when building Lucene 
index for exchange properties:

    protected void addExchangePropertiesToDocument(Exchange exchange,
                                                   Document document) {
        for (Map.Entry<String,Object> entry : 
exchange.getProperties().entrySet()) {
            if (entry.getValue() instanceof String) {
                document.add(new Field(FIELD_PROPERTIES + "." + entry.getKey(), 
(String) entry.getValue(), Field.Store.YES, Field.Index.ANALYZED));
            }
        }
    }

So that the value "aec94f2c-8763-4bd0-938d-e9cbb8d36a74" gets broken up into 
words "aec", "bd", etc, 
and there is no index for exactly "aec94f2c-8763-4bd0-938d-e9cbb8d36a74".

One possible solution is to index twice: once using Field.Index.ANALYZED and 
once using Field.Index.NOT_ANALYZED.



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

Reply via email to