You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by squallsama <gi...@git.apache.org> on 2018/05/05 11:57:43 UTC
[GitHub] lucene-solr pull request #371: SOLR-9685 tag a query in JSON syntax
GitHub user squallsama opened a pull request:
https://github.com/apache/lucene-solr/pull/371
SOLR-9685 tag a query in JSON syntax
Support following structure: {"#RCOLOR": { "term": { "f": "color","v": "blue"}}}
RCOLOR will be tag name
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/squallsama/lucene-solr 7_3_SOLR-9685
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/lucene-solr/pull/371.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #371
----
commit 732f11de1a4e8e10bbae8363f9cf511d65c91374
Author: Dmitry Tikhonov <dm...@...>
Date: 2018-03-29T17:54:47Z
SOLR-9685 tag a query in JSON syntax
Support following structure: {"#RCOLOR": { "term": { "f": "color","v": "blue"}}}
RCOLOR will be tag name
----
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[GitHub] lucene-solr pull request #371: SOLR-9685 tag a query in JSON syntax
Posted by m-khl <gi...@git.apache.org>.
Github user m-khl commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/371#discussion_r186446157
--- Diff: solr/core/src/java/org/apache/solr/request/json/JsonQueryConverter.java ---
@@ -69,6 +69,13 @@ private void buildLocalParams(StringBuilder builder, Object val, boolean isQPars
"Error when parsing json query, expect only one query parser here, but found : "+map.keySet());
}
String qtype = map.keySet().iterator().next();
+ String qTypeTrimmed = qtype.trim();
--- End diff --
Not sure why to trim. Makes no sense from my pow.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[GitHub] lucene-solr pull request #371: SOLR-9685 tag a query in JSON syntax
Posted by m-khl <gi...@git.apache.org>.
Github user m-khl commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/371#discussion_r186447413
--- Diff: solr/core/src/test/org/apache/solr/search/json/TestJsonRequest.java ---
@@ -401,4 +396,180 @@ public static void doJsonRequest(Client client, boolean isDistrib) throws Except
}
+ public static void doJsonRequestWithTag(Client client) throws Exception {
--- End diff --
I haven't seen the test for tagging just string like
``` "filter": ["title:solr"]``` -> ``` "filter": [{"#drag":"title:solr"}]```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[GitHub] lucene-solr pull request #371: SOLR-9685 tag a query in JSON syntax
Posted by m-khl <gi...@git.apache.org>.
Github user m-khl commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/371#discussion_r186445542
--- Diff: solr/core/src/java/org/apache/solr/request/json/JsonQueryConverter.java ---
@@ -77,7 +84,10 @@ private void buildLocalParams(StringBuilder builder, Object val, boolean isQPars
if (useSubBuilder) subBuilder = new StringBuilder();
- subBuilder = subBuilder.append("{!").append(qtype).append(' ');;
+ if (tagName != null) {
+ subBuilder.append("{!tag=").append(tagName).append("}");
--- End diff --
I believe it should be quoted to avoid problems with spaces inside of tags.
Also, would you mind to embed tag in the same ```{! }``` qparser, rather than wrap. I'm afraid of some edgecases.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[GitHub] lucene-solr pull request #371: SOLR-9685 tag a query in JSON syntax
Posted by m-khl <gi...@git.apache.org>.
Github user m-khl commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/371#discussion_r186446692
--- Diff: solr/core/src/java/org/apache/solr/request/json/JsonQueryConverter.java ---
@@ -69,6 +69,13 @@ private void buildLocalParams(StringBuilder builder, Object val, boolean isQPars
"Error when parsing json query, expect only one query parser here, but found : "+map.keySet());
}
String qtype = map.keySet().iterator().next();
+ String qTypeTrimmed = qtype.trim();
+ String tagName = null;
+ if (qTypeTrimmed.startsWith("#")) {
--- End diff --
and what if not? Do we have a test which verify that violating this syntax triggers an exception?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[GitHub] lucene-solr pull request #371: SOLR-9685 tag a query in JSON syntax
Posted by m-khl <gi...@git.apache.org>.
Github user m-khl commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/371#discussion_r186444765
--- Diff: solr/core/src/java/org/apache/solr/request/json/JsonQueryConverter.java ---
@@ -69,6 +69,13 @@ private void buildLocalParams(StringBuilder builder, Object val, boolean isQPars
"Error when parsing json query, expect only one query parser here, but found : "+map.keySet());
}
String qtype = map.keySet().iterator().next();
+ String qTypeTrimmed = qtype.trim();
+ String tagName = null;
+ if (qTypeTrimmed.startsWith("#")) {
+ tagName = qTypeTrimmed.substring(1);
--- End diff --
I suppose it makes more sense to keep hash in tag just to make it more noticeable and explicit.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[GitHub] lucene-solr pull request #371: SOLR-9685 tag a query in JSON syntax
Posted by m-khl <gi...@git.apache.org>.
Github user m-khl commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/371#discussion_r186445658
--- Diff: solr/core/src/test/org/apache/solr/search/json/TestJsonRequest.java ---
@@ -25,20 +25,20 @@
import org.junit.BeforeClass;
import org.junit.Test;
-@LuceneTestCase.SuppressCodecs({"Lucene3x","Lucene40","Lucene41","Lucene42","Lucene45","Appending"})
+@LuceneTestCase.SuppressCodecs({"Lucene3x", "Lucene40", "Lucene41", "Lucene42", "Lucene45", "Appending"})
--- End diff --
Please don't format the code.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org