You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Albert Tumanov (JIRA)" <ji...@apache.org> on 2010/11/26 18:53:24 UTC

[jira] Created: (SMX4NMR-237) LuceneAuditor - unable to search by exact property value

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:

smx@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.


[jira] Updated: (SMX4NMR-237) LuceneAuditor - unable to search by exact property value

Posted by "Albert Tumanov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SMX4NMR-237?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Albert Tumanov updated SMX4NMR-237:
-----------------------------------

    Attachment: patch.txt

Possible patch

> 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
>         Attachments: patch.txt
>
>
> 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:
> smx@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.