Ah, now that would explain why when I had documentType specified on my view, it was only indexing the documents for one form at a time (I need all documents indexed). I was trying to avoid having separate FTS views for each of my forms with a given documentID. I thought if there was one view that had different documentTypes then at query time I could limit my query to just those documents. But I guess that's really what having different views is all about.
I have two different ways I use FTS to search in my app: 1. Search for records within a specific form. 2. Search for records within ANY form. So I'm guessing I need a separate view for each of my individual forms, plus one big view that contains all my documents so I can do the ANY form search that I need. Either that or I have to embed the documentID inside each of my documents in the emit statement in the map block for the view and then include that in the FTS search term. It would be nice if there was a secondary index on an FTS view that could be used just for queries. So if that secondary index got populated with my documentID values, then I could do something like this (in SQL parlance): select * from fullTextView where content match 'Hunger Games*' AND secondaryIndex = 'frm-ABC123456789'; Then to do my ALL query I could leave off the parameter for the secondaryIndex and that would give me back all rows that match the search term. Back to the drawing board :-) Thanks, Brendan On Wednesday, August 19, 2015 at 12:01:22 PM UTC-6, Jens Alfke wrote: > > > On Aug 17, 2015, at 11:43 AM, Brendan Duddridge <[email protected] > <javascript:>> wrote: > > It would be super useful if you could specify documentType for a full text > query so you only get back documents of a specific type. > > > documentType is an aspect of the view, not of a query. It takes effect at > indexing time, by filtering which documents get passed to the map function. > > This is what I'm doing in code: > > CBLQuery *query = [fullTextView createQuery]; > query.fullTextQuery = searchTerm; > fullTextView.documentType = self.document.documentID; > > > You should set documentType *before* querying, ideally at the same time > you set the mapBlock, so that it’s in effect when the view gets indexed. > > —Jens > -- You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/5dc48e6c-b716-4f56-93d4-59ee0b3fddc9%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
