This is an automated email from the ASF dual-hosted git repository.

andy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/jena.git

commit 0b26b955e1af98d5280501be6f5a3b02de111055
Author: Øyvind Gjesdal <[email protected]>
AuthorDate: Tue Dec 19 22:25:43 2023 +0100

    GH-2094: Surround query string with field grouping to apply text field to 
all tokens
---
 .../src/main/java/org/apache/jena/query/text/TextIndexLucene.java    | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/jena-text/src/main/java/org/apache/jena/query/text/TextIndexLucene.java 
b/jena-text/src/main/java/org/apache/jena/query/text/TextIndexLucene.java
index aacb56713b..15587a2e57 100644
--- a/jena-text/src/main/java/org/apache/jena/query/text/TextIndexLucene.java
+++ b/jena-text/src/main/java/org/apache/jena/query/text/TextIndexLucene.java
@@ -694,17 +694,18 @@ public class TextIndexLucene implements TextIndex {
 
     private String composeQField(String qs, String textField, String lang, 
boolean usingSearchFor, List<String> searchForTags) {
         String textClause = "";
+        String fieldGroupingQueryString = "(" + qs + ")";
 
         if (usingSearchFor) {
             for (String tag : searchForTags) {
                 String tf = textField + "_" + tag;
-                textClause += tf + ":" + qs + " ";
+                textClause += tf + ": " + fieldGroupingQueryString + " ";
             }
         } else {
             if (this.isMultilingual && StringUtils.isNotEmpty(lang) && 
!lang.equals("none")) {
                 textField += "_" + lang;
             }
-            textClause = textField + ":" + qs + " ";
+            textClause = textField + ": " + fieldGroupingQueryString + " ";
         }
 
         return textClause;

Reply via email to