Search Types & Default Search Modes
There are a number of search modes that are supported by Pieces for Developers to assist you in finding the snippet or asset that you are looking for.
When in List View or Gallery View you can search to find any snippet based on two things:
- The Search Query that has been typed into the search input box.
- The Search Mode that has been set.
All Search Modes
We currently provide 4 unique search modes that all create different search experiences:
You can modify the search mode that you have set at any time by selecting the dropdown next to the magnifying glass search icon to the left of the Search input.
Blended
Blended takes advantage of all aspects of your code snippets, and is the default setting for Pieces Desktop. When this is set, you can use search in a traditional way, as you would with other search engines.
Full Text Search (FTS)
Full Text Search uses your text to directly match with text in a saved snippet. This matches specific characters, but not semantic meaning. For example:
Search | Snippet | Match? |
---|---|---|
batch | cd batchfile.md | Yes |
batch | cd copyfiles.bat | No |
Neural Code Search (NCS)
Neural Code Search takes advantage of semantic description and allows you use meaning to find the code you need. Take the above example and notice how the results are different:
Search | Snippet | Match? |
---|---|---|
batch | cd batchfile.md | No |
batch | cd copyfiles.bat | Yes |
When using NCS, you searched for a snippet that cds into a batchfile.
Search With Snippet
Using Search with Snippet allows you to search for other related snippets by pasting a code snippet into search. Your search results will be related code snippets that you've saved to Pieces.
You can also use Search with Snippet inside the Global Search view - read more about how it works here.
Search Filters
When searching inside our applications and plugins, you can apply specific search filters to narrow down the results that are returned to you in your list/gallery view.
In order to access this filters:
- Select your Search Bar and make sure that it is focused
- Once selected, you will be able to see the 'Search Filter' icon present where all the available Search Modes were previously located
- Before typing, you may notice that you cannot select the filter icon. You will need to first input at least 1 character into the search field
- Now that there is some input, select the search filter icon
- A Dialog will open
- Select the 'Add a Filter' button on the opened dialog (we wil use 'Language' in the later example)
- Three options will be present:
- Language: your results based on a specific coding language
- Tags: use a custom or generated tag to filter results
- Phrase: narrow down your results based on if a snippet includes a specific phrase
- Three options will be present:
- Then select a language from the dropdown after selecting 'language'
- (important) after selecting a language, be sure to press run to actively enact your filter on your search results
Other Search Filter Settings
You can also do a few other things once entering the filter flow in order to manage a filter or add to it. You can:
- Add multiple queries to your search filters
- Remove individual filters when adding multiples
You can see a small 'Trashcan' and 'Plus' icon after you select a filter that allows you to either remove and/or add a filter respectively.