简体   繁体   中英

How to do Fulltext search on the below Document with ArangoDB?

{
  "rootElement": {
    "names": {
      "name": [
        "Haseb",
        "Anil",
        "Ajinkya",
        {
          "city": "mumbai",
          "state": "maharashtra",
          "job": {
            "second": "bosch",
            "first": "infosys"
          }
        }
      ]
    },
    "places": {
      "place": {
        "origin": "INDIA",
        "current": "GERMANY"
      }
    }
  }
}

If I had the document like the above example and I want to search the value like "mumbai" or "infosys" then how would I do the indexing and search for the same.

As we already discussed in other questions, you can only index one field in the document.

How about using a yaml dump of the whole structure in another attribute that you do the index on?

So, lets say paralell to rootElement you add wordTokens with that dump, and put a fulltext index on that?

You would probably want to use some regular expressions to strip keywords from the yaml dump, and since you don't want to be able to de-serialize it, remove unneeded whitespace and linebreaks too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM