You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "MateuxLucax (via GitHub)" <gi...@apache.org> on 2024/10/19 17:38:13 UTC
[I] FVH BaseFragmentsBuilder does not properly support colored pre/post tags [lucene]
MateuxLucax opened a new issue, #13933:
URL: https://github.com/apache/lucene/issues/13933
### Description
Given the `BaseFragmentsBuilder` description:
```java
...
/**
* Base FragmentsBuilder implementation that supports colored pre/post tags and multivalued fields.
*
* <p>Uses {@link BoundaryScanner} to determine fragments.
*/
public abstract class BaseFragmentsBuilder implements FragmentsBuilder {
...
```
We assume that if we input a query and an array of pre and post tags, they will follow the same order, like:
| *Query* | *Pre tag* | *Post tag* |
|---|---|---|
| A B | `<ab>` | `</ab>` |
| C B | `<cb>` | `</cb>` |
| C A | `<ca>` | `</ca>` |
It will not tag in a ordered way as the current `BaseFragmentsBuilder` implementation gets tags in a almost random order:
```java
protected String getPreTag(String[] preTags, int num) {
int n = num % preTags.length;
return preTags[n];
}
```
This is links back to [this issue](https://issues.apache.org/jira/browse/LUCENE-2524).
I already done some initial work to solve a problem where I work, but I would like to have a proper solution for Lucene.
The root cause is in the `FieldQuery` `flatten`, `saveTerms` and `expand` methods. They do need to exist but they also mess the order of pre/post tags. The `termOrPhraseNumber` is used to get the preTag, and should follow the order of the queries.
I will try to add a unit test that properly illustrates this problem as it is kinda complex.
### Version and environment details
Lucene 3.0+
Any environment
--
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: issues-unsubscribe@lucene.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org