Extensis Logo SUPPORT | FORUMS | KNOWLEDGE BASE

Add Additional search fields


#1

Hi I have just taken over managing a digital assets library, we use netpublish sites to allow access to all of our users to access our assets.
My predecessor published catalouges that exceeded the 5 maximum search field in the templates, but i cannot find how this was done, does someone know how to achieve this as I wish to make adjustments to the existing, sites but cannot do it until i can add additional search fields.

Thanks


#2

Hi, you don’t say what version you have running/installed. But documentation on the NetPublish API and modifying custom templates is all in the ‘Portfolio Server 10 Admin Guide’ that is freely available to download from our website here.

If you’re running an older version, best to contact your Extensis representative directly for assistance.


#3

TL;DR version: hand code your search templates.

In more detail I’d note firstly that generally user aren’t encouraged to use large numbers of terms for queries as it tends to slow response time. If you find yourself needing 8 or 9 search terms likely it’s your data telling you it needs some better curating and some extra metadata. That said…

Yes, it’s perfectly possible to have more than 5 input terms. BUT, you can’t configure such search templates via the the NP Assistant publishing wizard; it’s hard-coded to only allow 5 choices. So, you need to hand code the templates. That means editing the NPT files and reading the NP API which is part of Portfolio Server Admin Guide since v9. The NP API hasn’t changed** between launch (alongside v7) and v10, though the latter only adds to existing functionality and doesn’t change existing stuff.

By way of expectation management, NP queries are parsed in left to right (i.e. top to bottom as written in a page’s code). also, nested queries such as are common in SQL are not supported***. You can do (A or B) and (C or D), NP will interpret that as (((A or B) and C) or D).

** Indeed, the original typos still survive including some code-breaking case-sensitive errors. So, expect some misdirection from the API doc. Corrections have been submitted, but never seem to get applied even when other parts of the manual are updated.

*** Enterprise users with SQL catalogues can write custom PHP?ASP pages directly querying the catalogue though of course that bypasses NP.


#4

Thanks for the replys,
Just to confirm I am using Portfolio 8.5.
I attempted to add additional fields into the search.np file and it had no affect, in fact as a test I removed all of the search fields from the search.np file and that also had no affect. Is this the correct file to be editing: *Extensis\Portfolio NetPublish\WebRoot\sites\Site\templates\search.np *

My javascripting knowledge is somewhat limited so as much help as possible would be greatly appreciated on this.

Thanks
Mark


#5

The file you’re editing is the live template created as a result of publishing. If editing the file had no effect on the live site I can only assume one or more of the following is happening:

  • You’re re-publishing the site after the edit - which would simply over-write the file you just edited resetting it to the original.

  • You’re not editing the HTML/NP code correctly.

  • You’re not editing the file for the correct site.

Are you on Mac or PC?

Are you publishing from a built-in set? If so, in order to edit the source code you will need to go to the last pane of NP Assistant and save the set as a copy. Where those files will reside will depend on your answer the previous question.


#6

Hi, Thanks again for getting back to me so quickly
Just to make it easier here is my step by step,
I went into the site specific folder* Extensis\Portfolio NetPublish\WebRoot\sites* and made a duplicate of one of the existing sites.
One that was created the new site appeared on our server and is accessible online, I then attempted to edit the search.np file, however none of the edits that i made showed up when i enter the site online.
As a test i removed all of the search fields from the search.np file , but no matter what I add or remove from the code in the file, the published site still remains exactly the same as when I first published it.

You’re re-publishing the site after the edit - which would simply over-write the file you just edited resetting it to the original. - How would I be doing this? Can you explain?
You’re not editing the HTML/NP code correctly. - As I mentioned above I have tried to even completly break the file to test the outcome, but with no affect.
You’re not editing the file for the correct site. - Since this is the folder for the site I published I must be editing the correct one.

I am on a PC

Are you publishing from a built-in set? Do you mean one of the built in templates? If so yes.

Sorry if I am coming across as being completly clueless, I am experienced in adminstering sites in html, so I am completly stumped as to why none of the edits I make are having any affect.

Thanks Again
Mark

Okay just as a post script, I just deleted all of the .np files from the templates folder of this site, and the site is still functioning normally, so obviously I am doing something very wrong here.


#7

OK, so you were editing a live site (on Windows).

Firstly, don’t dupe a live site folder; I won’t bore with the reason, tl;dr - just don’t!

Instead, if you want to just tweak the live site, duplicate the template search.np as search1.np. Either:

  • Edit search.np, save the file and your changes are live. If all goes wrong, simply delete search.np (the file you edited) and rename search1.np as search.np.

  • Alternatively, leave search.np as is and edit the copy search1.np and run it by altering '…&template-search.np…" in the URL calling the search page to “…&template=search1.np…”. That way, the normal site loads as usual and you can load your edited template to test by tweaking the URL. Once happy rename the templates so the edited on is search.np (as that’s the hard coded name in links from other templates.


#8

Fantastic, I cant believe it was as simple as the fact that I was working on a duplicated site. Everything is working right now.
Thanks for all of you help on this.