Exact search
I'm using the Java SDK to run a search within a specific folder. Unfortunately my search doesn't seem to work as I want it too. I want my search to be an EXACT search, so if I search for "12345-123", I want it to return only "12345-123", and not results like "12345-876". The search should search in text, title and metadata.
I tried adding quotes, as some documentation seems to indicate that should return an exact search, but that doesn't seem to do it.
Any ideas?
I'm using following code:
BoxSearchParameters bsp = new BoxSearchParameters(); //bsp.setQuery("\"" + query + "\""); bsp.setQuery(query); List foldersToSearch = new ArrayList(); foldersToSearch.add(folderId); bsp.setAncestorFolderIds(foldersToSearch); //Setup Result Partial Object PartialCollection searchResults = null; //Starting point of the result set long offset = 0; //Number of results that would be pulled back long limit = 1000; //Storing the full size of the results long fullSizeOfResult = 0; while (offset <= fullSizeOfResult) { searchResults = boxSearch.searchRange(offset, limit, bsp); fullSizeOfResult = searchResults.fullSize(); offset += limit; }
Please sign in to leave a comment.
Comments
2 comments