bitflicker64 commented on code in PR #2994:
URL: https://github.com/apache/hugegraph/pull/2994#discussion_r4240716119
##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphIndexTransaction.java:
##########
@@ -783,9 +792,7 @@ private ConditionQuery constructSearchQuery(ConditionQuery
query, MatchedIndex i
}
private boolean matchSearchIndexWords(String propValue, String fieldValue)
{
- Set<String> propValues = this.segmentWords(propValue);
- Set<String> words = this.segmentWords(fieldValue);
- return CollectionUtil.hasIntersection(propValues, words);
+ return IndexBuilder.searchPredicate(this.params().analyzer(),
fieldValue).test(propValue);
Review Comment:
Minor: `matchSearchIndexWords()` now builds a new analyzer for every element
it checks. `this.params().analyzer()` resolves to
`StandardHugeGraph.analyzer()` (lines 728-734), which reads two config options,
calls `LOG.debug()` and then `AnalyzerFactory.analyzer(name, mode)`. That
factory returns a new instance on every call, and for a registered custom
analyzer it goes through `getConstructor(String.class).newInstance(mode)`.
The method runs in the results filter of `constructSearchQuery()` (line
779), once per returned element per SEARCH field, and in the left-index cleanup
at line 1698. At the merge base it used `this.indexBuilder.segmentWords()`,
which reuses the analyzer created once in the constructor (line 111).
`this.segmentWords()` just below still does.
Requested change: keep the shared matcher but reuse the transaction's
analyzer, for example an instance `searchPredicate(String text)` on
`IndexBuilder` that passes `this.textAnalyzer`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]