Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-15821

Add an ability to do "join" so values of "from" field are managed as phrases for "to" field

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 8.10
    • None
    • query, query parsers
    • None
    • Do not believe this is environment-specific.

    Description

      I have 2 cores: core_a and core_b
      document_a_1 and document_a_2 are indexed in core_a

      [
       {
        "id":1,
        "name": "document_a_1",
        "field_a": "Strange name for human being"
       },
       {
        "id":2,
        "name": "document_a_2",
        "field_a": "Strange name for human"
       }
      ] 

      document_b is indexed in core_b

      {
       "id": 1,
       "name": "document_b",
       "field_b": "human being"
      } 

      I would like to find in core_a all documents that field_a contains field_b values of documents that name equals document_b
      So with SQL it would like this:

      SELECT *
      FROM core_a
      JOIN core_b
      ON name = "document_b" AND "field_a" like "%" + field_b + "%" 

      I suggest that the following join query should help me:

      POST http://localhost:8983/solr/core_a/select
      {
       "query": {
         "join": {
         "from": "field_b",
         "to": "field_a",
         "fromIndex": "core_b",
         "query": "name:document_b"
         },
       },
       "fields": "name"
      }

      So I expect that only document_a_1 will be returned

      If StandardTokenizerFactory is used for both field_a and field_b, then response contains document_a_1 and document_a_2
      If StandardTokenizerFactory is used for field_a and KeywordTokenizerFactory is used for field_b, then the response contains no documents

      How could I get the expected result by using join?

      Attachments

        Activity

          People

            Unassigned Unassigned
            garkhipov Gleb Arkhipov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: