On 12/18/2019 1:21 PM, Nan Yu wrote:
I am trying to find all files containing a keyword in a directory (and
many sub-directories).
I did a quick indexing using
bin/post -c myCore /RootDir
When I query the index using "keyword", all files whose path containing
the keyword will be included in the search result. For example:
/RootDir/KeywordReports/FileDoesNotContainKeyword.txt will be shown in the query result.
The query is: http://localhost:8983/solr/myCore/select?q=keyword
Is there a way to exclude files whose content does not contain the keyword but the path contains the keyword?
Should I re-index the directory using some extra parameter? Or use extra
condition in the query
It sounds like your default field is probably a catchall which has the
contents of multiple source fields copied to it, including the content
and the filename.
If you do not want the filename searched, then query a different field
which does not contain that information. You may need to adjust your
schema and reindex for this to be possible.
You haven't shared the configs for this index, so it is not possible for
us to confirm that guess.
Thanks,
Shawn