Skip to content

Commit

Permalink
Merge pull request #13 from polarityio/develop
Browse files Browse the repository at this point in the history
Add "Search Titles Only" option
  • Loading branch information
sarus authored Jul 19, 2023
2 parents 6a8b5db + 0578c2d commit 921a659
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 39 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ A comma delimited list of Confluence Space Keys to search. If left blank, all s

If checked, the integration will return fewer results with more of an exact string match on your entities.

### Search Titles Only

If checked, the integration will only search the title of pages

### Confluence Page Search

If checked, the integration will search keywords/phrases in Confluence pages
Expand Down
45 changes: 27 additions & 18 deletions config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ module.exports = {
'Your Confluence Base Url to include the schema (i.e., https://) and port if required. Example "https://mycompany.atlassian.net/wiki".',
default: '',
type: 'text',
userCanEdit: true,
adminOnly: false
userCanEdit: false,
adminOnly: true
},
{
key: 'confluenceType',
Expand Down Expand Up @@ -124,17 +124,17 @@ module.exports = {
description: 'Your Confluence account email address (only required for Confluence Cloud).',
default: '',
type: 'text',
userCanEdit: true,
adminOnly: false
userCanEdit: false,
adminOnly: true
},
{
key: 'apiKey',
name: 'Confluence API Token',
description: 'Your Confluence API token (required for both Confluence Server and Confluence Cloud)',
default: '',
type: 'password',
userCanEdit: true,
adminOnly: false
userCanEdit: false,
adminOnly: true
},
{
key: 'spaceKeys',
Expand All @@ -143,8 +143,8 @@ module.exports = {
'A comma delimited list of Confluence Space Keys to search. If left blank, all spaces will be searched.',
default: '',
type: 'text',
userCanEdit: true,
adminOnly: false
userCanEdit: false,
adminOnly: true
},
{
key: 'reduceFuzziness',
Expand All @@ -153,44 +153,53 @@ module.exports = {
'If checked, the integration will return fewer results with more of an exact string match on your entities.',
default: true,
type: 'boolean',
userCanEdit: true,
adminOnly: false
userCanEdit: false,
adminOnly: true
},
{
key: 'searchTitlesOnly',
name: 'Search Titles Only',
description: 'If checked, the integration will only search the title of pages',
default: false,
type: 'boolean',
userCanEdit: false,
adminOnly: true
},
{
key: 'searchPage',
name: 'Confluence Page Search',
description: 'If checked, the integration will search keywords/phrases in Confluence pages',
default: true,
type: 'boolean',
userCanEdit: true,
adminOnly: false
userCanEdit: false,
adminOnly: true
},
{
key: 'searchAttachments',
name: 'Confluence Attachment Search',
description: 'If checked, the integration will search keywords/phrases in Confluence attachments',
default: true,
type: 'boolean',
userCanEdit: true,
adminOnly: false
userCanEdit: false,
adminOnly: true
},
{
key: 'searchBlog',
name: 'Confluence Blog Search',
description: 'If checked, the integration will search keywords/phrases in Confluence blogs',
default: true,
type: 'boolean',
userCanEdit: true,
adminOnly: false
userCanEdit: false,
adminOnly: true
},
{
key: 'searchSpace',
name: 'Confluence Space Search',
description: 'If checked, the integration will return Confluence space names that contain the search term',
default: true,
type: 'boolean',
userCanEdit: true,
adminOnly: false
userCanEdit: false,
adminOnly: true
}
]
};
45 changes: 27 additions & 18 deletions config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"description": "Your Confluence Base Url to include the schema (i.e., https://) and port if required. Example \"https://mycompany.atlassian.net/wiki\".",
"default": "",
"type": "text",
"userCanEdit": true,
"adminOnly": false
"userCanEdit": false,
"adminOnly": true
},
{
"key": "confluenceType",
Expand Down Expand Up @@ -67,71 +67,80 @@
"description": "Your Confluence account email address (only required for Confluence Cloud).",
"default": "",
"type": "text",
"userCanEdit": true,
"adminOnly": false
"userCanEdit": false,
"adminOnly": true
},
{
"key": "apiKey",
"name": "Confluence API Token",
"description": "Your Confluence API token (required for both Confluence Server and Confluence Cloud)",
"default": "",
"type": "password",
"userCanEdit": true,
"adminOnly": false
"userCanEdit": false,
"adminOnly": true
},
{
"key": "spaceKeys",
"name": "Space Keys",
"description": "A comma delimited list of Confluence Space Keys to search. If left blank, all spaces will be searched.",
"default": "",
"type": "text",
"userCanEdit": true,
"adminOnly": false
"userCanEdit": false,
"adminOnly": true
},
{
"key": "reduceFuzziness",
"name": "Reduce Search Fuzziness",
"description": "If checked, the integration will return fewer results with more of an exact string match on your entities.",
"default": true,
"type": "boolean",
"userCanEdit": true,
"adminOnly": false
"userCanEdit": false,
"adminOnly": true
},
{
"key": "searchTitlesOnly",
"name": "Search Titles Only",
"description": "If checked, the integration will only search the title of pages",
"default": false,
"type": "boolean",
"userCanEdit": false,
"adminOnly": true
},
{
"key": "searchPage",
"name": "Confluence Page Search",
"description": "If checked, the integration will search keywords/phrases in Confluence pages",
"default": true,
"type": "boolean",
"userCanEdit": true,
"adminOnly": false
"userCanEdit": false,
"adminOnly": true
},
{
"key": "searchAttachments",
"name": "Confluence Attachment Search",
"description": "If checked, the integration will search keywords/phrases in Confluence attachments",
"default": true,
"type": "boolean",
"userCanEdit": true,
"adminOnly": false
"userCanEdit": false,
"adminOnly": true
},
{
"key": "searchBlog",
"name": "Confluence Blog Search",
"description": "If checked, the integration will search keywords/phrases in Confluence blogs",
"default": true,
"type": "boolean",
"userCanEdit": true,
"adminOnly": false
"userCanEdit": false,
"adminOnly": true
},
{
"key": "searchSpace",
"name": "Confluence Space Search",
"description": "If checked, the integration will return Confluence space names that contain the search term",
"default": true,
"type": "boolean",
"userCanEdit": true,
"adminOnly": false
"userCanEdit": false,
"adminOnly": true
}
]
}
4 changes: 3 additions & 1 deletion integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ function _createQuery(entityObj, options) {
keyString = ` and space.key IN (${keys.join(',')}) `;
}

let query = `text~'${
let searchLocation = options.searchTitlesOnly ? 'title' : 'text';

let query = `${searchLocation}~'${
!options.reduceFuzziness
? fp.flow(fp.split(/[^\w]/g), fp.compact, fp.join(' '))(entityObj.value)
: `"${entityObj.value}"~-0.5`
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Confluence",
"version": "3.2.5",
"version": "3.3.0",
"main": "./integration.js",
"private": true,
"dependencies": {
Expand Down

0 comments on commit 921a659

Please sign in to comment.