twskj/pretty-swag

Consider `filterByTag` requiring all listed tags instead of any

Closed this issue ยท 12 comments

filterByTag computes the union of all apis rather than an intersection. In my case, this is pretty useless, as each of my "apis" have quite a few tags and any union shows a lot entries.

An intersection would be much better as my "apis" are classified according to three criteria into disjoint groups and using two tags in conjunction would allow finding the wanted "api" rather immediately.

The implementation is not the problem, the questions are:

  • would the intersection behavior be useful for others?
  • should it be configurable or should there be a new syntax (e.g., +tag making the tag mandatory)?
  • in case of the new syntax, should clicking on a tag add it to input#search as it or with + prefixed?
twskj commented

You can exclude tags by using - prefix. For example, if we want all customer but not with DELETE method, we would type customer -DELETE

Is this something you are looking for?

twskj commented

Come to think about it, intersection has its place too. Maybe we could have a flag that can choose between OR or AND

twskj commented

I decided to do "doubleQuote" instead of +
The behavior will be

  • the search will return only documents that contain search term in double quotaiton
  • clicking at tag will default to double quotation

I proposed + because it's what Google search did some long time ago, but I can live with double quote equally well. ๐Ÿ˜† I'm glad about it being the new default.

twskj commented

I have the search functionality in place. I'll polish it a bit before checking with you :-)

twskj commented

Rolled out!
Check it out and let me know.

You've also changes the search to require the full quoted tag, which is much better for me, as I have quite a few tags like XYZ and XYZ_ITEM. Fantastic!

The possibility to remove a tag by clicking is nice, too!

twskj commented

Just to sum it up for my future reference

The behavior of the filtering is as follow:

  • Using -tag to remove api that contain that particular tag
  • Surrounding tag with double quotation "tag" to narrow down to only api that contains the tag
  • Typing in normally is a blanket search which will match anything that start with that tag

There's one more thing.... the list shows really the available tags only, i.e., it changes all the time, which makes it much less practical. Always showing the full list and disabling the unavailable tags would be IMHO much better. Do you like the idea?

If so, then the styling should be so that disabling a tag does not change it's width; otherwise, the following would would move, which is ugly.

twskj commented

hmm I like your idea actually. Since now we color them blue, we can easily grey them instead of removing ๐Ÿค”

Can you justify further or give some use cases why is it much better?

Assuming, the tag list is not too huge (my tags are just two lines as I'm using "autoTags": false), it's much better.

  • After adding a wrong tag, I can click again on the same position to remove it.
  • I can find the tag much faster as it's always on the same position.
  • I don't waste time with searching a tag, which isn't there.
twskj commented

previously added