Feature request: add "Whole Words Only" tick-box to search/find

Bug #1208578 reported by thinkpad
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
qpdfview
Fix Released
Wishlist
Adam Reichold

Bug Description

Feature request:

Please add

"Whole Words Only" tick-box

to search/find.

Many thanks!

Changed in qpdfview:
importance: Undecided → Wishlist
Revision history for this message
Benjamin Eltzner (b-eltzner) wrote :

I am not sure whether this can be implemented reasonably well in a fashion that is compatible with any alphabet. If I am not mistaken this would require a kind of "universal list of punctuation marks, brackets, etc." that would be acceptable as either neighbour of the searchword.

Changed in qpdfview:
status: New → Won't Fix
Revision history for this message
Adam Reichold (adamreichold) wrote :

Hello,

As Benjamin pointed out, this is something that needs a lot of locale- and/or document-dependent handling and heuristics and therefore I see it out of the scope of a nimble program like qpdfview, hence marking the bug as won't fix.

Regards, Adam.

P.S.: Again, please reconsider posting several feature requests in short succession. Rather report a single bug and follow it up until is properly triaged or if implementation starts right away, try to accompany that with testing and remarks. Also, please try to devise more concise and expressive bug descriptions, e.g. for this bug, try to describe what this option is actually supposed to do depending on the different possibilities for user input. And please try to explain things without comments like "c.f. Adobe Reader". Make your reports stand on their own by explaining things. (I don't have that program available and I certainly won't install it somewhere to copy some feature or other.)

Revision history for this message
Ari (ari-lp) wrote :

Note: I was planning on posting a separate bug report originally, but seeing how thinkpad already requested this feature I will post my thoughts here.

----

Hey guys,

it's been a while, so first I would like to thank you for your continuous work on qpdfview. I've noticed that qpdfview has made some great strides over the past few months and I'd like to extend my heartfelt thanks to everyone involved in the process.

I was very glad to see the extended search interface get implemented. It has made searching across multiple documents and navigating through the results a breeze.

One feature I feel is still missing from qpdview's search interface is an option to limit the results to whole-world matches only. For instance, searching for 'crease' will also yield `decrease` and `increase` by default. With a whole-word option active one could restrict the results to 'crease' which could be very useful in some scenarios.

I think that this would be a fantastic addition to qpdview.

----

While I understand that you don't like comparisons to other projects I'd just like give you a status update on the implementation of this feature in other prominent PDF viewers on Linux:

- Evince: From what I understand `whole-word` search, alongside other advanced search options, was introduced with the 3.8.2 release (https://bugs.launchpad.net/ubuntu/+source/evince/+bug/360152/comments/6)

- Okular: Has been on the wishlist for a few years now (https://bugs.kde.org/show_bug.cgi?id=204709)

Digging further into the Evince commit (https://github.com/GNOME/evince/blob/a182f12f1bd7002e06ab59481404252c1147a7f1/backend/pdf/ev-poppler.cc, ll. 1692f) I found that whole-word search seems to be supported by the poppler backend itself now. In fact, if you check the Poppler documentation page you will find the `POPPLER_FIND_WHOLE_WORDS_ONLY` flag in the listing of all poppler find flags:

> enum PopplerFindFlags
>
> typedef enum {
> POPPLER_FIND_DEFAULT = 0,
> POPPLER_FIND_CASE_SENSITIVE = 1 << 0,
> POPPLER_FIND_BACKWARDS = 1 << 1,
> POPPLER_FIND_WHOLE_WORDS_ONLY = 1 << 2
> } PopplerFindFlags;
> Flags using while searching text in a page
>
> POPPLER_FIND_DEFAULT
>
> POPPLER_FIND_CASE_SENSITIVE
>
> do case sensitive search
> POPPLER_FIND_BACKWARDS
>
> search backwards
> POPPLER_FIND_WHOLE_WORDS_ONLY
>
> search only whole words
> Since 0.22

cf.: http://people.freedesktop.org/~ajohnson/docs/poppler-glib/poppler-poppler.html

With these changes to the backend and the inclusion in Evince in mind, I think it would only be fair to reconsider marking this feature request as `won't fix`.

Thank you for taking the time to read this comment.

Cheers

-- Ari

Revision history for this message
Adam Reichold (adamreichold) wrote :

Hello Ari,

the whole-words option is actually only exposed by the Glib frontend which qpdfview does not use. However, I just submitted a patch as an RFC to the Poppler mailing list exposing this in the Qt frontends as well. If we are able to sort out compatibility questions and the patch is committed, I'll include this option within qpdfview if used with Poppler. (Not sure what we'll do about the other backends though.)

Best regards, Adam.

Revision history for this message
Ari (ari-lp) wrote :

> the whole-words option is actually only exposed by the Glib frontend which qpdfview does not use

Ah, I see. Sorry I missed that.

> I just submitted a patch as an RFC to the Poppler mailing list exposing this in the Qt frontends as well

Awesome! Here's hoping that it gets accepted.

> If we are able to sort out compatibility questions and the patch is committed, I'll include this option within qpdfview if used with Poppler.

That's great to hear. I'll be standing by for any testing if you need me.

Thanks for getting on this right away, Adam. Once again I am astonished by your quick response to user feedback!

Changed in qpdfview:
status: Won't Fix → In Progress
assignee: nobody → Adam Reichold (adamreichold)
milestone: none → 0.4.14
Revision history for this message
Adam Reichold (adamreichold) wrote :

Ok, the patch basically got accepted (it is still open for review for a week) and I added the necessary bits and pieces to qpdfview's trunk. After the patch is committed to Poppler's master, I'll integrate it into qpdfview so that it can be tested. (The DjVu backend will already honor the flag, but its search function is limited anyway.)

Revision history for this message
Ari (ari-lp) wrote :

Awesome! Thanks for going the extra mile with this! Looking forward to trying the new option out.

Revision history for this message
Adam Reichold (adamreichold) wrote :

Hello again,

the necessary changes are now within Poppler's master and qpdfview's trunk branch. Testing would be appreciated but will also be complicated: One has to grab and build Poppler's master branch and then build our trunk against it after modifying "pdf-plugin.pro" to define "HAS_POPPLER_31" since only then will the new API be accesible.

I'll be happy to help if someone is willing to try it out, but I also think that the probability of problems is low since the code within Poppler is already excercised by Evince and API additions are pretty trivial. Of course, only more testing down the road will show for sure...

Best regards, Adam.

Revision history for this message
Ari (ari-lp) wrote :

Hi Adam,

that's great news. As it happens I am still on Ubuntu 12.04 unfortunately. Do you think it would be possible to compile and install the latest Poppler master branch without messing up my system too much? I'd really love to help with testing, but I think I might have to hold off if it's too troublesome and dangerous.

Cheers

-- Ari

Revision history for this message
Adam Reichold (adamreichold) wrote :

Hello Ari,

yes you can very well wreck your system as some programs like some LaTeX tools often link directly with "libpoppler" instead of the frontend libraries, which is not guaranteed to be compatible between releases. Hence I'd say you are better off trying this in a virtual machine or just waiting for the versions to reach using the normal cycle.

One other option would be to use Benjamin's PPA which contains an updated Poppler build for Ubuntu 12.04 and a qpdfview package built against it, but I don't know if he plans to update it for Poppler 0.31.

Best regards, Adam.

[1] https://launchpad.net/~b-eltzner/+archive/ubuntu/qpdfview-exp-daily

Changed in qpdfview:
status: In Progress → Fix Committed
Revision history for this message
Ari (ari-lp) wrote :

Thanks for the warning! In that case I think I will have to sit this one out.

Cheers

-- Ari

Changed in qpdfview:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.