Problem/Motivation
It does not seem possible to search all of the data indexed for a given entity using Views.
Steps to reproduce
Create a search index which indexes all (node) content, leave it with the default configuration.
Create a number of nodes with just a title, no body field.
Index the content.
Create a View which searches this index, add a (Fulltext) search filter which is exposed; do not change any options.
In the preview search for one of the words from the title of one of the nodes.
Expected results:
* Nodes show in the display.
What happens:
* No content shows in the display.
Proposed resolution
Provide an option in the Views interface to search the entire index, not just the fulltext fields.
Remaining tasks
Work out a solution.
Comments
Comment #2
damienmckennaComment #3
drunken monkeySorry, but I either don’t understand the problem or fail to follow your reasoning. Yes, if you want to do a fulltext search on a field, it needs to be indexed as type “Fulltext”. Why would that be a problem – especially now in D8, where you can index the same field multiple times?
Server backends (have to (be able to)) rely on the fields that should be fulltext-searchable to be specified in advance. Removing that requirement would make their job a lot harder, and (perhaps drastically) reduce their performance, for little extra gain.
Also, it sounds like you created the index without any fields (“default configuration”)? How would searching that even work?
If I completely misunderstood you, then sorry, please try to explain again.
Otherwise, it seems to me like you haven’t really understood how the Search API works, and I advise you to read up on it before trying to use it. (It’s unfortunately not very beginner-friendly.) But I admit that the handbook might be missing some fundamentals, as it’s (as you probably know) not easy to know, as an expert, what questions a beginner would have. So, if you feel there’s something missing or you have a question about the basics of how the Search API works, feel free to ask (e.g., on the #search Slack channel) and maybe we can make the documentation more helpful.
Finally, if you want a quick and dirty way of “just searching through all content”, simply create an index with a single “Rendered HTML output” field – that would probably come closest to what you want.
Comment #4
damienmckennaThere were a few parts of the initial setup that I was mistaken on / were not clear (for someone who hadn't set up a new Search API server in a year-or-so):
I think if text/string fields were set to "fulltext" by default, and the UI was tweaked a little, this confusion wouldn't arise.
Suggested wording changes:
I'd be happy to work on patches for these changes if you'd be willing to consider them.
Comment #5
damienmckennaI created one issue to change the way text/string fields are handled by default: #3224311
Comment #6
marios anagnostopoulos commentedAs I mentioned in #3224311 having just a fulltext search is not the most common scenario.
Considering that the api implementation should be leaning towards good experience on the most common scenarios and not the "first time setup" experience, I think it should stay as it is.
What I would suggest though is to add an anchor link of some sort labeled (Read More about field types) or w/e, that would scroll to the "Data Types" details section, since there is an explanation there. From what I gather, most people, especially if they are new to the search_api, will find the module overwhelming and will miss such things. So making the field type explanation a bit more "obvious" to newcomers might help a bit.
Comment #7
damienmckennaAn alternative to #3224311 would be to make the title field default to fulltext, I didn't dig into what it would take to make that one work.
Comment #8
drunken monkeyI’m definitely open to changing the wording in the “Data types” table. I’m very much aware that I’m not the best at writing such descriptions, especially if they are supposed to be beginner-friendly.
So, if you have a suggestion, I’m all ears.
Regarding the “anchor link of some sort” linking to that table: That’s already there, right at the top of the page. (Even when the Help module is disabled, it’s completely baked into the page.)
We also specifically mention and link to that table in the Tour for that page.
Comment #9
anybodyJust read this and have to agree with @DamienMcKenna that from a developer / site builder experience, you would expect to have an easy way to "search everything indexed". Not being deep in the SOLR / Elastic world, until I read this, I thought that it's just a case of "varchar" vs. "text" (by maximum length) to set in the type. I wouldn't expect that fields set to "string" are not part of the full text search.
So I think we should start from the expected functionality: "Search everything indexed" and see if there's a more intuitive way. Changing the label or adding documentation is one option, but I think there's a high risk that "regular developers" or site builders don't get the full stack of reasons what the type selection means, coming from the points above.
Perhaps we could separate the "full text search" from something like "every text search" (no good name, just for explanation) which does, what you'd expect and also searches texts?
A possible workaround, at least for some cases, is to add "rendered_item" as full text, right? I guess it should also contain the title?
Comment #10
drunken monkeyAs tantalizing as a search that “just works” sounds, I assure you it is not that easy to accomplish. And I can guarantee you that what you call “expected functionality” is far from a consensus.
Therefore, I will definitely not change any current functionality or defaults without a larger consensus around where we should go. An issue with four participants (with two disagreeing halves, to boot) is definitely not enough as a starting point.
However, there are already proposals for building more beginner-friendly shortcuts around the complex complete configuration process – e.g., #2574895: Add a wizard for easily creating a search setup. Could that maybe be helpful?
In any case, any proposal for improvements is further hampered by needing someone to actually implement them, and me being very short on free contrib time for quite some time now.
Comment #11
lubwn commentedI am having trouble to make this module even work. I spent solid 6 hours on tweaking the settings here and there and the result is still that it does not show any results in views, it either shows all the nodes or none at all. Documentation is not helpful at all.
For me to understand that some fields needs to be "fulltext" took a few hours of digging through stackoverflow threads / documentation of search API, and guess when I found out? When I was deleting / adding the fulltext search exposed filter back to views it says something like "used for searching in fulltext type fields" or so. This is when I realised I need to check the settings and tweak the fields I want to be searched as fulltext. What an awful experience.
I think for average joe / site builder like myself this working just out of the box would be super helpful. Even a small things like setting node titles as fulltexts always because everyone wants to search node titles would come handy and save a few hours of googling here and there.